본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)5.1k · #15051

migrate-goldmark-extension-v1-to-v2

하는 일

확장 기능이 goldmark v2와 함께 작동하도록 필요한 변경을 계획하고 실행합니다. 새 방식의 확장 기능을 작성하는 방법도 포함합니다. goldmark 확장 기능을 관리하는 Go 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓goldmark 확장 기능을 관리하고 있고 v2에서 작동하게 하고 싶을 때.
  • ✓v2용 goldmark 확장 기능을 작성하는 방법을 배우고 싶을 때.
  • ✓확장 기능에 대해 goldmark v1과 v2 사이의 호환성 깨짐 변경을 설명받고 싶을 때.

스킬 링크

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에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/yuin/goldmark/blob/v2/.agent-plugins/migrate-goldmark-v1-to-v2/skills/migrate-goldmark-extension-v1-to-v2/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 goldmark 표 확장 기능을 v1에서 v2로 옮기고, 테스트하는 방법도 보여 주세요.”

매주 새 스킬 5개. 읽는 데 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
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬