highlight-blade
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Highlight Blade

Highlight Laravel Blade & Alpine.js syntax with highlight.js.

You can see the highlight results here.

Installation

Using npm to download the library.

npm install highlight.js hightlight-blade

Importing the Library

To use the Blade template definition with highlight.js, you have two options for importing:

Optimized Import (Recommended)

Load only the language definitions you need.

// import core hljs api and required languages
import hljs from 'highlight.js/lib/core';
import javascript from 'highlight.js/lib/languages/javascript';
import xml from 'highlight.js/lib/languages/xml';
import php from 'highlight.js/lib/languages/php';
import blade from 'highlight-blade';

// register each language definition
hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('xml', xml);
hljs.registerLanguage('php', php);
hljs.registerLanguage('blade', blade);

Full Import

Load all languages of highlight.js, please note that this generates a large file.

import hljs from 'highlight.js';
import blade from 'highlight-blade';

hljs.registerLanguage('blade', blade);

More information about importing highlight.js library, please refer to here.

TODO

  • [x] Support Laravel Blade syntax
  • [x] Support Alpine.js syntax

Package Sidebar

Install

npm i highlight-blade

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

9.19 kB

Total Files

8

Last publish

Collaborators

  • yilanboy