@celine/bibhtml is a Web
Components-based referencing system for HTML documents. It aims to provide a similar user experience to
referencing in LaTeX/BibTeX. It's a thin wrapper around Citation.js
GitHub | MaxwellBo/ |
License | MIT |
---|---|---|---|
JSR | jsr.io/ |
Version | 0.2.0, |
Add the following script to your HTML file's <head>
element:
@celine/bibhtml is structured around 3 custom elements:
<bibhtml-bibliography>
The <bibhtml-bibliography>
contains <bibhtml-reference>
s and renders them in a formatted list (like at the bottom of the page). References are rendered in the order they are cited by <bibhtml-cite>
elements, not the order they are declared in <bibhtml-bibliography>
.
The format
attribute sets the citation style. Currently only "apa"
(default) is supported.
<bibhtml-bibliography format="apa"> <bibhtml-reference id="willighagen2019"> @article{willighagen2019, title = {Citation.js: a format-independent, modular bibliography tool for the browser and command line}, author = {Willighagen, Lars G.}, year = 2019, month = aug, keywords = {Bibliography, Javascript}, volume = 5, pages = {e214}, journal = {PeerJ Computer Science}, issn = {2376-5992}, url = {https://doi.org/10.7717/peerj-cs.214}, doi = {10.7717/peerj-cs.214} } </bibhtml-reference> ... </bibhtml-bibliography>
<bibhtml-reference>
Each <bibhtml-reference>
must be tagged with an id
attribute, and contain reference information in 4 supported formats.
This expands to reference
A <bibhtml-reference>
can contain unstructured text. This format is useful when:
The Sun is hot
This expands to reference
This expands to reference
<bibhtml-cite>
Say we wanted to cite Citation.js<bibhtml-cite>
element:
Alternatively, rather than citing Citation.jsref
attribute to specify the ID. This allows you to put a fallback in the element
if JavaScript fails to load:
When citing a reference