Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links for (@) numbered example lists #4837

Open
zeeMonkeez opened this issue Aug 16, 2018 · 3 comments
Open

Links for (@) numbered example lists #4837

zeeMonkeez opened this issue Aug 16, 2018 · 3 comments

Comments

@zeeMonkeez
Copy link

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.

@jgm
Copy link
Owner

jgm commented Aug 18, 2018

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.

@aernesto
Copy link

Do any of you know whether this has been implemented since the last comment?

@jgm
Copy link
Owner

jgm commented Aug 16, 2022

If it had been, this issue would be closed :)

Unfortunately it's a bit awkward to implement this. The most elegant way to do it would involve a small change in pandoc-types, adding a label parameter to the Example constructor for ordered list styles. But changes to pandoc-types are messy because they affect a very large ecosystem, so we try to minimize them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants