मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)5.1k · #15051

migrate-goldmark-extension-v1-to-v2

यह क्या करती है

यह एक्सटेंशन को goldmark v2 के साथ काम करने लायक बनाने के बदलाव योजनाबद्ध करती और लागू करती है, जिसमें नई शैली का एक्सटेंशन लिखना भी शामिल है। यह उन Go डेवलपर्स के लिए है जो goldmark एक्सटेंशन सँभालते हैं।

कब इस्तेमाल करें

  • ✓जब आप goldmark एक्सटेंशन के मालिक हैं और चाहते हैं कि वह v2 के साथ काम करे।
  • ✓जब आपको v2 के लिए goldmark एक्सटेंशन लिखना सीखना है।
  • ✓जब आप चाहते हैं कि एक्सटेंशन के लिए goldmark v1 और v2 के टूटने वाले बदलाव समझाए जाएँ।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/yuin/goldmark/blob/v2/.agent-plugins/migrate-goldmark-v1-to-v2/skills/migrate-goldmark-extension-v1-to-v2/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे goldmark टेबल एक्सटेंशन को v1 से v2 पर ले जाइए, और मुझे दिखाइए कि उसे कैसे टेस्ट करूँ।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

आपका एजेंट मंज़ूरी के लिए माइग्रेशन योजना लिखता है, एक्सटेंशन कोड अपडेट करता है, और आपके चुने उदाहरणों से उसे टेस्ट करता है। इसके लिए वह एक्सटेंशन बनाने और टूटने वाले बदलावों की संदर्भ गाइड इस्तेमाल करता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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)
        
अक्सर पूछे जाने वाले सवाल

क्या एजेंट टेस्ट के लिए मेरे अपने उदाहरण इस्तेमाल करता है?

वह पूछता है कि आप एक्सटेंशन की जाँच कैसे चाहते हैं, और आपके दिए टेस्ट केस या उदाहरण इस्तेमाल करता है।

क्या कोड बदलने से पहले मेरी मंज़ूरी चाहिए?

हाँ। पहले माइग्रेशन योजना की पुष्टि ज़रूरी है।

क्या यह नए एक्सटेंशन लिखने में भी मदद करता है?

हाँ। इसमें v2 में एक्सटेंशन बनाने की गाइड शामिल है।

जानकारी

लेखक का मूल विवरण

Migrate goldmark extension from goldmark v1 to v2.

repo: yuin/goldmark

लोकप्रियता

GitHub स्टार
5.1k
रैंकिंग में स्थान
#15051
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills