migrate-goldmark-extension-v1-to-v2
Skill này làm gì
Skill này lập kế hoạch và thực hiện các thay đổi để một phần mở rộng hoạt động với goldmark v2, gồm cách viết một phần mở rộng theo kiểu mới. Skill dành cho lập trình viên Go duy trì các phần mở rộng goldmark.
Khi nào nên dùng
- ✓Khi bạn duy trì một phần mở rộng goldmark và muốn nó hoạt động với v2.
- ✓Khi bạn cần học cách viết một phần mở rộng goldmark cho v2.
- ✓Khi bạn muốn các thay đổi làm hỏng tương thích giữa v1 và v2 được giải thích cho một phần mở rộng.
Liên kết skill
https://github.com/yuin/goldmark/blob/v2/.agent-plugins/migrate-goldmark-v1-to-v2/skills/migrate-goldmark-extension-v1-to-v2/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Giúp tôi chuyển phần mở rộng bảng goldmark của tôi từ v1 lên v2, và chỉ tôi cách kiểm thử.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent viết kế hoạch chuyển đổi để bạn duyệt, cập nhật mã phần mở rộng và kiểm thử nó bằng các ví dụ bạn chọn. Agent dùng các hướng dẫn tham chiếu về cách tạo phần mở rộng và các thay đổi làm hỏng tương thích.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
Câu hỏi thường gặp
Agent có dùng ví dụ của tôi để kiểm thử không?
Nó hỏi bạn muốn kiểm thử phần mở rộng thế nào và dùng các ca kiểm thử hoặc ví dụ bạn cung cấp.
Nó có cần tôi duyệt trước khi sửa mã không?
Có. Kế hoạch chuyển đổi phải được xác nhận trước.
Nó có bao gồm cả việc viết phần mở rộng mới không?
Có. Nó có một hướng dẫn về cách tạo phần mở rộng trong v2.
Chi tiết
Độ phổ biến
- Sao GitHub
- 5.1k
- Vị trí xếp hạng
- #15051
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.