migrate-goldmark-extension-v1-to-v2
What it does
It plans and carries out the changes needed for an extension to work with goldmark v2, including how to write a new-style extension. It is for Go developers who maintain goldmark extensions.
When to use it
- ✓When you maintain a goldmark extension and want it to work with v2.
- ✓When you need to learn how to write a goldmark extension for v2.
- ✓When you want the breaking changes between goldmark v1 and v2 explained for an extension.
Skill link
https://github.com/yuin/goldmark/blob/v2/.agent-plugins/migrate-goldmark-v1-to-v2/skills/migrate-goldmark-extension-v1-to-v2/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Help me migrate my goldmark table extension from v1 to v2, and show me how to test it.”
5 new skills a week. 1 minute to read.
How it works
The agent writes a migration plan for you to approve, updates the extension code, and tests it with examples you choose. It uses the reference guides on creating extensions and breaking changes.
Technical content (original SKILL.md)
Original text by the author, straight from 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 // ... }
- v1
- e.g. :
AST nodes
- use
text.Value(single line),text.MultiLineValue(multi-line) instead of[]bytefor values that can be parsed from source text in inline AST nodes.- In your parser, you must choose
text.Decoderimplementation to decode the source valuetext.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 usetext.IdentityDecoderunless you have a clear intention to do so.
- In your parser, you must choose
- use
text.Linesinstead of[]text.Segmentfor values in block AST nodes that have raw contents like HTML blocks, code blocks, etc. - Properties in AST Dump should be
text.Valueas 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)
- OK:
- e.g.
FAQ
Does the agent use my own examples to test?
It asks how you want to test the extension and uses the test cases or examples you provide.
Does it need my approval before changing code?
Yes. The migration plan must be confirmed first.
Does it cover writing new extensions too?
Yes. It includes a guide on how to create an extension in v2.
Details
Original description by the author
Migrate goldmark extension from goldmark v1 to v2.
repo: yuin/goldmark
Popularity
- GitHub stars
- 5.1k
- Ranking position
- #15051
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.