Documentation
¶
Overview ¶
Package tocdirective implements MDS035, which flags renderer-specific table-of-contents directives that render as literal text on CommonMark and goldmark.
Index ¶
- type Rule
- func (r *Rule) Category() string
- func (r *Rule) Check(f *lint.File) []lint.Diagnostic
- func (r *Rule) CheckNode(n ast.Node, entering bool, f *lint.File) []lint.Diagnostic
- func (r *Rule) EnabledByDefault() bool
- func (r *Rule) Fix(f *lint.File) []byte
- func (r *Rule) ID() string
- func (r *Rule) Name() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule struct{}
Rule detects renderer-specific TOC directives.
func (*Rule) Check ¶
func (r *Rule) Check(f *lint.File) []lint.Diagnostic
Check implements rule.Rule. The per-paragraph logic is pure and stateless once the `hasTOCRef` lookup is shared via File.Memo; the engine can fold this rule into one shared AST walk and a direct call still works via rule.WalkNodes.
func (*Rule) EnabledByDefault ¶
EnabledByDefault implements rule.Defaultable.
func (*Rule) Fix ¶
Fix implements rule.FixableRule. Each matched TOC directive token on its own line is replaced with an empty <?toc?>\n<?/toc?> block. Blank lines are inserted above and below when adjacent content would otherwise fuse the block into a paragraph. Only replaces tokens inside Paragraph nodes (same as Check), avoiding code blocks and other contexts.