pandoc/test/command/7632.md
John MacFarlane 0a93acf91a Markdown reader: don't parse links or bracketed spans as citations.
Previously pandoc would parse

    [link to (@a)](url)

as a citation; similarly

    [(@a)]{#ident}

This is undesirable.  One should be able to use example references
in citations, and even if `@a` is not defined as an example
reference, `[@a](url)` should be a link containing an author-in-text
citation rather than a normal citation followed by literal `(url)`.

Closes #7632.
2021-10-20 10:34:47 -07:00

1.2 KiB

% pandoc -t native
(@a) First case

[link to (@a)](url)
^D
[ OrderedList
    ( 1 , Example , TwoParens )
    [ [ Plain [ Str "First" , Space , Str "case" ] ] ]
, Para
    [ Link
        ( "" , [] , [] )
        [ Str "link" , Space , Str "to" , Space , Str "(1)" ]
        ( "url" , "" )
    ]
]
% pandoc -t native
[@a]{.class}
^D
[ Para
    [ Span
        ( "" , [ "class" ] , [] )
        [ Cite
            [ Citation
                { citationId = "a"
                , citationPrefix = []
                , citationSuffix = []
                , citationMode = AuthorInText
                , citationNoteNum = 1
                , citationHash = 0
                }
            ]
            [ Str "@a" ]
        ]
    ]
]

% pandoc -t native
[@a](url)
^D
[ Para
    [ Link
        ( "" , [] , [] )
        [ Cite
            [ Citation
                { citationId = "a"
                , citationPrefix = []
                , citationSuffix = []
                , citationMode = AuthorInText
                , citationNoteNum = 1
                , citationHash = 0
                }
            ]
            [ Str "@a" ]
        ]
        ( "url" , "" )
    ]
]