Pandoc: Links for (@) numbered example lists

Created on 16 Aug 2018  路  1Comment  路  Source: jgm/pandoc

Currently, (@)-numbered lists (example lists), when tags are defined and used for reference in running text, do not generate links.

For example:

(@ex) This is an example

Refer to (@ex) for an example

Will be converted to LaTeX:

\begin{enumerate}
\def\labelenumi{(\arabic{enumi})}
\tightlist
\item
  This is an example
\end{enumerate}

Refer to (1) for an example

It would be desirable if the reference would link back to the list item.

Markdown reader

Most helpful comment

Perhaps this should be handled at the markdown reader level instead. Currently the markdown

(@foo) hi

See (@foo)

gets parsed as

[OrderedList (1,Example,TwoParens)
 [[Plain [Str "hi"]]]
,Para [Str "See",Space,Str "(1)"]]

What if we instead parsed it as:

[OrderedList (1,Example,TwoParens)
 [[Plain [Span ("example-1",[],[]) [Str "hi"]]]]
,Para [Str "See",Space,Link ("",[],[]) [Str "(1)"] ("#example-1","")]]

Then you'd get the links for free in LaTeX, and also in other formats.

>All comments

Perhaps this should be handled at the markdown reader level instead. Currently the markdown

(@foo) hi

See (@foo)

gets parsed as

[OrderedList (1,Example,TwoParens)
 [[Plain [Str "hi"]]]
,Para [Str "See",Space,Str "(1)"]]

What if we instead parsed it as:

[OrderedList (1,Example,TwoParens)
 [[Plain [Span ("example-1",[],[]) [Str "hi"]]]]
,Para [Str "See",Space,Link ("",[],[]) [Str "(1)"] ("#example-1","")]]

Then you'd get the links for free in LaTeX, and also in other formats.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthijskooijman picture matthijskooijman  路  54Comments

dashed picture dashed  路  107Comments

brainchild0 picture brainchild0  路  66Comments

elliottslaughter picture elliottslaughter  路  44Comments

phyllisstein picture phyllisstein  路  84Comments