Skip to content

A language definition for BibTeX in the PrismJS syntax highlighting framework.

License

Notifications You must be signed in to change notification settings

SaswatPadhi/prismjs-bibtex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrismJS-BibTeX

npm package jsDelivr hits

A BibTeX language extension for PrismJS.

Usage

In HTML

Simply import the prism-bibtex.min.js (recommended at the end of body):

<script src="https://cdn.jsdelivr.net/npm/prismjs-bibtex@2.1.0/prism-bibtex.min.js">
</script>

I recommend using the SRI (Subresource Integrity) hash as well:

<script src="https://cdn.jsdelivr.net/npm/prismjs-bibtex@2.1.0/prism-bibtex.js"
        integrity="sha256-A5GMUmGHpY8mVpfcaRLQFeHtmdjZLumKBOMpf81FXX0="
        crossorigin="anonymous" referrerpolicy="no-referrer">
</script>

Remember to import the PrismJS stylesheets and scripts before importing this extension. For example:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-solarizedlight.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js">
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs-bibtex@2.1.0/prism-bibtex.min.js">
</script>

In NodeJS

  1. Add the package to your project:

    $ npm install prismjs-bibtex
  2. Import prismjs-bibtex your .js file, after Prism:

    import Prism from 'prismjs';
    import 'prismjs-bibtex';

Examples

Check out some small BibTeX examples on the project webpage. You can also check the performance on large real-life .bib files below: