-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support bibliography and citations linking to it in HTML #6952
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
Conversation
Packed<BibliographyElem>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! I wanted to leave some initial thoughts before further opinions from the team. Most of them are related to code style and general quality, but otherwise this is looking nice! Let me know if you have any questions.
By the way, please don't close your pull request in order to apply changes, even if you want to start fresh. This causes the original conversation history and reviews to be lost (or, rather, not attached to the new PR), making it harder to navigate the discussion.
Instead, push any new changes to the pull request's branch in your fork. If you need to reset your changes, you can, for example, push a change where you just replace all files with what they were before you started your work. Thanks! :)
The `.linked` call in the bibliography call didn't automatically affect HTML export, but with the workaround using `DirectLinkElem` (and in the future just direct usage of `LinkElem`), we can use the same linking code across all targets.
This means that the `id` of a bibliography entry is attached to its `<li>` element instead of to the first leaf
This only has an effect for the (rather rare) styles that use `display="left-margin"`.
Just like in outline and footnote list
A follow-on from #6894 that hews more closely to the HTML spec in terms of roles and also provides links from citations to their references.
I noticed that the work of finding the appropriate locations was already done when parsing the keys etc from hayagriva, so it seemed more appropriate to surface that in the
Works
data structure than to do it again. But I am still new to Typst internals, so please let me know if this is the correct approach or if there are downstream consequences of adding a field of which I might not be aware.Performance implications
The implications of adding the extra hash map to the
Works
data structure seem (from my naive point of view) acceptable because:.bib
file. Thus while it does require some extra memory in the compiler, it is not a large amount (I don't think), and it scales linearly with the number of items that appear in the bibliography.Questions
It's not entirely clear to me why the
CiteGroup
doesn't automatically create aLinkElem
in the HTML render pathway. I assume from #6917 that it has to be explicitly added for some reason to get an<a>
tag to appear in HTML, but I would be happy for someone to point out that there is some easier way to get it than what I have done here.With thanks to @willcrichton for his help in thinking about this change (though any and all deficiencies in the approach are my responsibility solely!)