用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/yuin/goldmark --skill migrate-goldmark-extension-v1-to-v2命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | migrate-goldmark-extension-v1-to-v2 |
| context | fork |
| description | Migrate goldmark extension from goldmark v1 to v2. |
| allowed-tools | Bash Read |
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.
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
// ...
}
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
// ...
}
var Parser = NewParser() // Default instance of parser extension
func NewHTMLRenderer(opts ...HTMLRendererOption) html.Extension { // takes renderer options
// ...
}
var HTMLRenderer = NewHTMLRenderer() // Default instance of renderer extension
text.Value(single line), text.MultiLineValue(multi-line) instead of []byte for values that can be parsed from source text in inline AST nodes.
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.text.Decoder. DO NOT use text.IdentityDecoder unless you have a clear intention to do so.text.Lines instead of []text.Segment for values in block AST nodes that have raw contents like HTML blocks, code blocks, etc.text.Value as possible.
// 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)
}
// Dump implements Node.Dump.
func (n *Text) Dump(source []byte) *NodeDump {
m := map[string]any{
"Value": n.Value.Str(source), // string
}
fs := textFlagsString(n.flags)
if len(fs) != 0 {
m["Flags"] = fs
}
return NewNodeDump(n, m)
}
text.Value which has almost the same specification as HTML attributes.
goldmark_v1_attribute build tag to continue using v1 attributes as they are.SetPos appropriately.text.Value and text.Lines can be rendered using the WriteTo method whenever possible. Also, the output destination of WriteTo should use html.ContextHTMLWriter(rc) or html.ContextTextWriter(rc).
tw := html.ContextTextWriter(rc)
_, _ = n.Value.WriteTo(tw, source)
WriteTo is fast because it does not allocate new memory. On the other hand, if you write Value directly like tw.Write(n.Value.Value(source)), it may copy the contents of Value, which can degrade performance.myext.NewParser() and myext.NewHTMLRenderer() for the extension constructors.
meta extension
meta.NewParser(), meta.NewHTMLRenderer()myext.Parser and myext.HTMLRenderer as the default extension values.
var Parser = NewParser(), var HTMLRenderer = NewHTMLRenderer()myext.ParserOption and myext.HTMLRendererOption for functional options.
type ParseOption func(*parserConfig), type HTMLRendererOption func(*htmlRendererConfig)main or master. User must create a new branch like 'v2' to work on the migration before using this skill.
main or master, STOP this skill and ask human to create a new branch like 'v2' to work on the migration.go.mod file is updated to use github.com/yuin/goldmark/v2 instead of github.com/yuin/goldmark. User must add goldmark/v2 before using this skill.
go.mod file is not updated, STOP this skill and ask human to update go.mod file to use github.com/yuin/goldmark/v2 instead of github.com/yuin/goldmark.go.mod file with new major version. For example, change github.com/you/yourextension to github.com/you/yourextension/v2.
go.mod file before proceeding with the migration.
go.mod file with new major version.