Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wetmore/markdown-it-highlightjs
Browse files Browse the repository at this point in the history
  • Loading branch information
wetmore committed Jul 1, 2020
2 parents 5bc782a + 730b571 commit 98faa69
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | Whether to highlight inline code. | `false`

### Register languages

Expand All @@ -33,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).

0 comments on commit 98faa69

Please sign in to comment.