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

tolot27 picture tolot27  路  5Comments

naught101 picture naught101  路  5Comments

cnblogs-dudu picture cnblogs-dudu  路  5Comments

RyanGreenup picture RyanGreenup  路  4Comments

transientsolutions picture transientsolutions  路  3Comments