Langsung ke konten
Skillpedia
API & server (backend)5.1k · #15051

migrate-goldmark-extension-v1-to-v2

Fungsinya

Skill ini merencanakan dan menjalankan perubahan yang diperlukan agar sebuah ekstensi bisa bekerja dengan goldmark v2, termasuk cara menulis ekstensi gaya baru. Skill ini untuk pengembang Go yang memelihara ekstensi goldmark.

Kapan dipakai

  • ✓Saat Anda memelihara ekstensi goldmark dan ingin ekstensi itu bekerja dengan v2.
  • ✓Saat Anda perlu belajar cara menulis ekstensi goldmark untuk v2.
  • ✓Saat Anda ingin perubahan yang memutus kompatibilitas antara goldmark v1 dan v2 dijelaskan untuk sebuah ekstensi.

Link skill

https://github.com/yuin/goldmark/blob/v2/.agent-plugins/migrate-goldmark-v1-to-v2/skills/migrate-goldmark-extension-v1-to-v2/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/yuin/goldmark/blob/v2/.agent-plugins/migrate-goldmark-v1-to-v2/skills/migrate-goldmark-extension-v1-to-v2/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Bantu saya memigrasikan ekstensi tabel goldmark saya dari v1 ke v2, dan tunjukkan cara mengujinya.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent menulis rencana migrasi untuk Anda setujui, memperbarui kode ekstensi, dan mmengujinya dengan contoh yang Anda pilih. Agent memakai panduan referensi tentang pembuatan ekstensi dan perubahan yang memutus kompatibilitas.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

migrate-goldmark-extension-v1-to-v2

Description

This skill helps you migrate a goldmark (https://github.com/yuin/goldmark) extension from version 1 to version 2. It provides guidance on the changes needed to update your project to be compatible with the new version of goldmark.

Knowledges

  • CommonMark key points : List of key points of CommonMark spec that you should be aware of when implementing a goldmark extension.
  • Breaking changes in v2 : List of breaking changes in goldmark v2 that you should be aware of when migrating your extension from v1 to v2.
  • How to create an extension : Guide on how to create a goldmark extension in v2, including the new extension pattern and how to implement parser and renderer extensions.

Migration steps

Overview of the migration process

  • Create a migration plan for the extension.
  • MUST ask human to confirm that the migration plan is acceptable before proceeding with the migration.
  • MUST ask human to how to test the extension after migration before proceeding with the migration.
    • e.g. : "How do you want to test the extension after migration? Do you have any test cases or examples that you want to use for testing?"
  • Execute the migration plan to update the extension code to be compatible with goldmark v2.
  • Update the test cases to ensure that the extension works as expected with goldmark v2.
  • Test the extension with goldmark v2 to ensure that it works as expected. If there are any issues, fix them and re-test until the extension works as expected.
  • Update the documentation to reflect any changes made during the migration process.

Create a migration plan

Task

  • Make sure you have read and understood the Breaking changes in v2 document.
  • Make sure you have read and understood the How to create an extension document.
  • You create a ./features/goldmark-migration-plan.md file that contains a migration plan for the extension.

Key points to consider when migrating your extension

Extension options
  • If the extension uses "unified" options for both parser and renderer, they should be split into separate options for each.
    • e.g. :
      • v1
        type Option interface {
            myOption()
        }
        
        type ParserOption interface {
            Option
            applyParserOption(*parserConfig)
        }
        
        type RendererOption interface {
            Option
            applyRendererOption(*rendererConfig)
        }
        
        func New(opts ...Option) goldmark.Extender { // takes unified options
            // ...
        }
        
      • v2
        type ParserOption interface {
            applyParserOption(*parserConfig)
        }
        
        type HTMLRendererOption interface { // explicitly named for **HTML**
            applyRendererOption(*htmlRendererConfig) // you can access the shared renderer config like `XHTML` or `Unsafe` in the renderer config
        }
        
        func NewParser(opts ...ParserOption) parser.Extension { // takes parser options
            // ...
        }
        
        func NewHTMLRenderer(opts ...HTMLRendererOption) html.Extension { // takes renderer options
            // ...
        }
        
AST nodes
  • use text.Value(single line), text.MultiLineValue(multi-line) instead of []byte for values that can be parsed from source text in inline AST nodes.
    • In your parser, you must choose text.Decoder implementation to decode the source value
      • text.IdentityDecoder : for raw contents like inline HTMLs, inline code, etc.
      • reader.Decoder : other contents like text, links, etc. This decoder decodes entity references, \ escapes, etc.
    • In most cases, you will choose text.Decoder. DO NOT use text.IdentityDecoder unless you have a clear intention to do so.
  • use text.Lines instead of []text.Segment for values in block AST nodes that have raw contents like HTML blocks, code blocks, etc.
  • Properties in AST Dump should be text.Value as possible.
    • e.g.
      • OK:
        // Dump implements Node.Dump.
        func (n *Text) Dump(_ []byte) *NodeDump {
            m := map[string]any{
                "Value": n.Value, // text.Value
            }
            fs := textFlagsString(n.flags)
            if len(fs) != 0 {
                m["Flags"] = fs
            }
            return NewNodeDump(n, m)
        
Pertanyaan umum

Apakah agent memakai contoh saya sendiri untuk pengujian?

Agent menanyakan cara Anda ingin menguji ekstensi dan memakai kasus uji atau contoh yang Anda berikan.

Apakah perlu persetujuan saya sebelum mengubah kode?

Ya. Rencana migrasi harus dikonfirmasi lebih dulu.

Apakah ini juga mencakup menulis ekstensi baru?

Ya. Skill ini mencakup panduan tentang cara membuat ekstensi di v2.

Detail

Deskripsi asli dari pembuat

Migrate goldmark extension from goldmark v1 to v2.

repo: yuin/goldmark

Popularitas

Bintang GitHub
5.1k
Peringkat
#15051
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa