1234567891011121314151617181920212223242526272829303132 |
- ---
- title: Syntax Highlighter Module
- ---
- The Syntax Module enhances the Code Block format by automatically detecting and applying syntax highlighting. The excellent [highlight.js](https://highlightjs.org/) library is used as a dependency to parse and tokenize code blocks.
- In general, you may [configure](https://highlightjs.readthedocs.io/en/latest/api.html#configure-options) highlight.js as needed. However, Quill expects and requires the `useBR` option to be `false`.
- ### Example
- ```html
- <!-- Include your favorite highlight.js stylesheet -->
- <link href="highlight.js/monokai-sublime.min.css" rel="stylesheet">
- <!-- Include the highlight.js library -->
- <script href="highlight.js"></script>
- <script>
- hljs.configure({ // optionally configure hljs
- languages: ['javascript', 'ruby', 'python']
- });
- const quill = new Quill('#editor', {
- modules: {
- syntax: true, // Include syntax module
- toolbar: [['code-block']] // Include button in toolbar
- },
- theme: 'snow'
- });
- </script>
- ```
|