@pavelloz/eleventy-plugin-syntaxhighlight

0.0.3 • Public • Published

@pavelloz/eleventy-plugin-syntaxhighlight

This package simply adds line numbers support to Eleventy to official @11ty/eleventy-plugin-syntaxhighligh

It escapes {%, {{, }} and %} to pass liquid validation.

Installation

npm install --save-dev  @akumzy/eleventy-plugin-syntaxhighlight

Configuration

const syntaxHighlight = require('@akumzy/eleventy-plugin-syntaxhighlight')

module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(syntaxHighlight,  { showLineNumbers: false, alwaysWrapLineHighlights:false })
}

Markup Usage

```js#/1-2
function myFunction() {
  let highlighted = true;
  return highlighted;
}
```


To start with a specific line number, add the number enclosed with square brackets eg. [2] after the hash mark (#).

The line numbers for this code fence will start at 2 plus the highlighting syntax.

```json#[2]2,3
{
  "all": [...],
  "nav": [...],
  "books": [
    {
      "inputPath": "./src/articles/finding-oz.md",
      "outputPath": "_site/articles/finding-oz/index.html",
      "fileSlug": "finding-oz",
      "data": {...},
      "date": "2009-08-07T13:52:12.000Z",
      "url": "/articles/finding-oz/",
      "templateContent": "<p>As with most books ... much about The Wizard of Oz</li>\n</ul>\n",
      "template": {...}
    },
    ...
  ],
  "programming": [...],
}
```

Credits

Readme

Keywords

none

Package Sidebar

Install

npm i @pavelloz/eleventy-plugin-syntaxhighlight

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

7.86 kB

Total Files

4

Last publish

Collaborators

  • pavelloz