diff --git a/extension/_test/footnote.txt b/extension/_test/footnote.txt index 34cb5c0..9b06721 100644 --- a/extension/_test/footnote.txt +++ b/extension/_test/footnote.txt @@ -48,3 +48,21 @@ This[^3] is[^1] text with footnotes[^2]. //= = = = = = = = = = = = = = = = = = = = = = = =// + + +5 +//- - - - - - - - -// +test![^1] + +[^1]: footnote +//- - - - - - - - -// +

test1

+
+
+
    +
  1. +

    footnote ↩︎

    +
  2. +
+
+//= = = = = = = = = = = = = = = = = = = = = = = =// diff --git a/extension/footnote.go b/extension/footnote.go index 592d7f4..ede72db 100644 --- a/extension/footnote.go +++ b/extension/footnote.go @@ -114,12 +114,17 @@ func NewFootnoteParser() parser.InlineParser { } func (s *footnoteParser) Trigger() []byte { - return []byte{'['} + // footnote syntax probably conflict with the image syntax. + // So we need trigger this parser with '!'. + return []byte{'!', '['} } func (s *footnoteParser) Parse(parent gast.Node, block text.Reader, pc parser.Context) gast.Node { line, segment := block.PeekLine() pos := 1 + if len(line) > 0 && line[0] == '!' { + pos++ + } if pos >= len(line) || line[pos] != '^' { return nil }