Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)5.1k · #15050

migrate-goldmark-app-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 cần thiết cho goldmark v2, bắt đầu bằng một kế hoạch bạn duyệt và kết thúc bằng kiểm thử. Skill dành cho lập trình viên Go dùng goldmark trong một ứng dụng.

Khi nào nên dùng

  • ✓Khi ứng dụng Go của bạn dùng goldmark v1 và bạn muốn chuyển lên v2.
  • ✓Khi bạn cần xem các thay đổi làm hỏng tương thích giữa goldmark v1 và v2.
  • ✓Khi bạn muốn kế hoạch chuyển đổi được xác nhận trước khi bắt đầu thay đổi mã.

Liên kết skill

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

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/yuin/goldmark/blob/v2/.agent-plugins/migrate-goldmark-v1-to-v2/skills/migrate-goldmark-app-v1-to-v2/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Giúp tôi chuyển ứng dụng Go của tôi từ goldmark v1 lên v2, và xác nhận kế hoạch với tôi trước khi thay đổi bất kỳ mã nào.”

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 xác nhận, cập nhật mã, điều chỉnh các kiểm thử và chạy chúng trên goldmark v2. Agent dùng các tài liệu tham chiếu về những 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-app-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.

Migration steps

Overview of the migration process

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

Extension

  • If the application contains own extensions, you can use /migrate-goldmark-extension-v1-to-v2 skill to migrate the extensions.
  • If the application contains third-party extensions, you need to check if the extensions provide v2 compatible version. - If not, STOP the migration.

Key points to consider when migrating your application

goldmark.Markdown alternatives
  • In v2, goldmark.Markdown is removed. Therefore, you need to replace it with one of the following two patterns:
    • Pattern 1: Use parser.Parser and renderer.Renderer to create your own goldmark.Markdown alternative.
      • Example:
        // MarkdownToStringFunc is a function type that converts markdown to HTML.
        type MarkdownToStringFunc func(source string) (string, error)
        
        // NewMarkdownToStringFunc returns a MarkdownToStringFunc that uses the given parser and renderer.
        func NewMarkdownToStringFunc(p parser.Parser, r html.Renderer) MarkdownToStringFunc {
            return func(source string) (string, error) {
                var buf bytes.Buffer
                b := util.StringToReadOnlyBytes(source)
                doc := p.Parse(b)
                if err := r.Render(&buf, b, doc); err != nil {
                    return "", err
                }
                return buf.String(), nil
            }
        }
        
    • Pattern 2: Use parser.Parser and renderer.Renderer separately.
      • Example:
        var buf bytes.Buffer
        p := parser.New(parser.WithAttribute(), parser.WithExtensions(extension.NewStrikethroughParser()))
        r := html.New(html.WithXHTML(), html.WithUnsafe(), html.WithExtensions(extension.NewStrikethroughHTMLRenderer()))
        doc := p.Parse(b)
        err := r.Render(&buf, b, doc)
        
  • Extensions MUST NOT be shared among multiple parsers/renderers. Create them with the New* constructors (e.g. extension.NewTableParser()) for each parser/renderer instead of using the deprecated default instances (e.g. extension.TableParser).
AST
  • In v1, AST values are mostly 'raw' values; entities references and \ escapes are not resolved. In v2, AST values are resolved values.
    • You need to check if your application relies on the 'raw' values of AST nodes.
      • If your application relies on the resolved values of AST nodes, you should replace Value.Bytes and Value.Str methods with Value.Value method.
      • Otherwise, you should replace Value.Bytes and Value.Str methods with Value.Value method.
  • In v2, to make the AST more semantic, some breaking changes have occurred.
Câu hỏi thường gặp

Agent có bắt đầu sửa mã ngay không?

Không. Skill yêu cầu bạn xác nhận kế hoạch chuyển đổi và nói cách kiểm thử trước.

Điều gì giúp nó biết các thay đổi của v2?

Các tài liệu tham chiếu về thay đổi làm hỏng tương thích trong v2 và các điểm chính của CommonMark.

Có skill riêng cho phần mở rộng không?

Có. Việc chuyển một phần mở rộng goldmark có skill riêng.

Chi tiết

Mô tả gốc của tác giả

Migrate your application from goldmark v1 to v2.

repo: yuin/goldmark

Độ phổ biến

Sao GitHub
5.1k
Vị trí xếp hạng
#15050
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự