gomarkdown / markdown

markdown parser and HTML renderer for Go
Other
1.36k stars 171 forks source link

How to customize the parser to parse new syntax #269

Closed zhouyusd closed 1 year ago

zhouyusd commented 1 year ago

For example:

你好,[--blank--]

And define a struct

type Blank struct {
    Leaf
    ...
}

I need to parse [--blank--]

kjk commented 1 year ago

For block-level items, see Parser.Opts.ParserHook. Example: https://github.com/gomarkdown/markdown/blob/ad838ccf8cddb117ffc05842f60db3e2389cf471/parser/options_test.go#L32

kjk commented 1 year ago

Note: there is no way to add inline-level custom parsing. Also note that [--blank--] is already a markdown syntax for links.