tocdirective

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tocdirective implements MDS035, which flags renderer-specific table-of-contents directives that render as literal text on CommonMark and goldmark.

Index

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) Category

func (r *Rule) Category() string

Category implements rule.Rule.

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) CheckNode added in v0.23.0

func (r *Rule) CheckNode(n ast.Node, entering bool, f *lint.File) []lint.Diagnostic

CheckNode implements rule.NodeChecker.

func (*Rule) EnabledByDefault

func (r *Rule) EnabledByDefault() bool

EnabledByDefault implements rule.Defaultable.

func (*Rule) Fix

func (r *Rule) Fix(f *lint.File) []byte

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.

func (*Rule) ID

func (r *Rule) ID() string

ID implements rule.Rule.

func (*Rule) Name

func (r *Rule) Name() string

Name implements rule.Rule.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL