From d25b3a7e52cab7ce44835c9b3f23ee9094e0abc2 Mon Sep 17 00:00:00 2001 From: Matthew Wetmore Date: Wed, 1 Jul 2020 02:58:15 -0400 Subject: [PATCH 1/3] Add option to readma --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 70b29a1..dd32807 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Name | Type | Description `auto` | boolean | Whether to automatically detect language if not specified. | `true` `code` | boolean | Whether to add the `hljs` class to raw code blocks (not fenced blocks). | `true` `register` | object | Register other languages which are not included in the standard pack. | `null` +`inline` | boolean | Highlight inline code blocks | `null` ### Register languages From 56243d88e0a0e91329a6adca00fdf37fcb69fcf6 Mon Sep 17 00:00:00 2001 From: Matthew Wetmore Date: Wed, 1 Jul 2020 02:59:09 -0400 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd32807..2ac84cc 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Name | Type | Description `auto` | boolean | Whether to automatically detect language if not specified. | `true` `code` | boolean | Whether to add the `hljs` class to raw code blocks (not fenced blocks). | `true` `register` | object | Register other languages which are not included in the standard pack. | `null` -`inline` | boolean | Highlight inline code blocks | `null` +`inline` | boolean | Highlight inline code blocks | `false` ### Register languages From 730b571b9a48673fd39c92673558875dd9257a40 Mon Sep 17 00:00:00 2001 From: Matthew Wetmore Date: Wed, 1 Jul 2020 03:13:55 -0400 Subject: [PATCH 3/3] More docs --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ac84cc..beac9d1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Name | Type | Description `auto` | boolean | Whether to automatically detect language if not specified. | `true` `code` | boolean | Whether to add the `hljs` class to raw code blocks (not fenced blocks). | `true` `register` | object | Register other languages which are not included in the standard pack. | `null` -`inline` | boolean | Highlight inline code blocks | `false` +`inline` | boolean | Whether to highlight inline code. | `false` ### Register languages @@ -34,3 +34,26 @@ const md = require('markdown-it')() } }) ``` + +### Inline code highlighting + +You can enable inline code highlighting by setting `inline` to true: + +```js +const md = require('markdown-it')() + .use(require('markdown-it-highlightjs'), { inline: true }) +``` + +You can specify the language for inline code using [Pandoc syntax](https://pandoc.org/MANUAL.html#extension-inline_code_attributes): + +```markdown +`x=4`{.js} +``` + +or [Kramdown IAL syntax](https://kramdown.gettalong.org/syntax.html#inline-attribute-lists) + +```markdown +`x=4`{:.js} +``` + +If you do not specify a language, then highlight.js will attempt to guess the language if `auto` is true (which it is by default).