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

Feature: clickable references to bibliography entry #3

Closed
arothuis opened this issue Jun 7, 2022 · 7 comments · Fixed by #16
Closed

Feature: clickable references to bibliography entry #3

arothuis opened this issue Jun 7, 2022 · 7 comments · Fixed by #16

Comments

@arothuis
Copy link
Owner

arothuis commented Jun 7, 2022

At a minimum, this requires wrapping citations in <a> tags in the renderer.

Challenges

A solution needs to be designed for supporting multiple citation items in a single citation.
How much control does citeproc-js give us? Is this feasible while supporting every possible CSL style and locale?
It would be nice if the anchors could go both ways.

Future changes, out of scope for now

Support namespaces to make it possible to have links to multiple bibliographies per document.
This comes in handy when multiple MD-pages are rendered on the same HTML page (i.e. with SSG or paged media).

Note: multiple bibliographies are possible, see: #6 Not namespaced but order-based.

@bavalpey
Copy link

Would really like to see this. I understand the difficulty when multiple citations are used.
Perhaps make it work for single citations?

@arothuis
Copy link
Owner Author

Thanks for the comment. Could you tell me a bit more about your use case and what you mean by "single citation"?

@bavalpey
Copy link

Thanks for the comment. Could you tell me a bit more about your use case and what you mean by "single citation"?

Sure! I'm using this along with vitepress to create a nice github pages website for an ISA Reference (basically a language reference for a specific flavor of assembly). I have references to academic papers within the document, and want them to be familiar to users (so, IEEE style documentation).
Specifically, I'm using the ieee-with-urls.csl (side note: I've found that this extension does not insert the correct in-text citation number, it always writes [1]).

So, basically, if I write something like

Here we reference the excellent work by John Doe [@doe-2024].

Which right now appears as

Here we reference the excellent work by John Doe [1]

(In the default apa-csl, I think it appears like (Doe, J 2024) or something..)

I would like to be able to have readers click the citation number to jump to the entry in the bibliography. So it would appear like

Here we reference the excellent work by John Doe [1]

[1] Doe, John "An Excellent Title", 2024

This requires inserting an anchor before wherever the entry occurs in the bibliography.

As for single citation, what I mean is when there is only one citation in the list (like in my example). That is opposed to the multiple citations form supported by this extension (which may be difficult to do, I'm not sure)

@arothuis
Copy link
Owner Author

arothuis commented Feb 15, 2024

Thanks for your detailed description.

It could be that ieee-with-urls.csl currently does not work correctly with how the results are parsed and formatted. We use biblatex-csl-converter and citeproc-js so, as an aside, it might be interesting to find out the limitations of our approach and document or fix them.

That being said, clickable references to sources and back, is an interesting feature regardless of chosen style. I'll look at this once I have some more time.

@bavalpey
Copy link

Thanks for your detailed description.

It could be that ieee-with-urls.csl currently does not work correctly with how the results are parsed and formatted. We use biblatex-csl-converter and citeproc-js so, as an aside, it might be interesting to find out the limitations of our approach and document or fix them.

That being said, clickable references to sources and back, is an interesting feature regardless of chosen style. I'll look at this once I have some more time.

Thanks! I was going to open a separate issue for that so as to not go off topic here, but I wanted to see if I could figure it out first.

I'm guessing that the library citeproc is difficult to use, and this makes adding anchors and hyperrefs to the citations it returns non trivial?

@arothuis
Copy link
Owner Author

Indeed, we are just dumping the contents returned by its makeBibliography function. Unless there is a way to configure that function and supply it with custom IDs for anchoring, we need to build our own.

This costs some time, but allows for customization.

@arothuis
Copy link
Owner Author

arothuis commented Apr 7, 2024

I have created a PR with the following (breaking) changes:

  • updated project dependencies
  • added wrappers with an id to citations will become default behavior (breaking)
  • added bib-ids based on the position in the .bib-file will become default behavior (breaking)
  • added a linkToBibliography configuration option
  • added anchor tag from a citation to a bibliography if linkToBibliography is set to true

This will introduce a new major version.

For multiple citation items, it will link to the first listed item.

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