File: README.md

package info (click to toggle)
node-prismjs-bibtex 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,084 kB
  • sloc: javascript: 47; makefile: 4
file content (70 lines) | stat: -rw-r--r-- 2,060 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
PrismJS-BibTeX
========

A [BibTeX] language extension for [PrismJS].

<p align="center">
  <img src="docs/screenshot.png" width="720"/>  
</p>

## Usage

### In HTML

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

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

I recommend using the [SRI (Subresource Integrity)][SRI] hash as well:
```html
<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:

```html
<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:

    ```console
    $ npm install prismjs-bibtex
    ```

2. Import `prismjs-bibtex` your .js file, after Prism:

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



## Examples

Check out some small BibTeX examples [on the project webpage](https://saswatpadhi.github.io/prismjs-bibtex/). You can also check the performance on large real-life `.bib` files below:
- (~68&thinsp;KB) [Some BibTeX examples from CTAN](https://saswatpadhi.github.io/prismjs-bibtex/biblatex-examples.html)
- (~144&thinsp;KB) [Bibliography of ACM Turing Award lectures](https://saswatpadhi.github.io/prismjs-bibtex/acm-turing-awards.html)
- (~534&thinsp;KB) [STOC 2010 -- 2019 bibliography](https://saswatpadhi.github.io/prismjs-bibtex/stoc_2010-2019.html)





[BibTeX]:   http://www.bibtex.org/
[prismjs]:  https://prismjs.com/
[SRI]:      https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity