Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fix(rehype)!: deprecate and disable highlightLines option
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 14, 2024
1 parent 21e9955 commit fe0e4cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/packages/rehype.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ const file = await unified()

### Line Highlight

::: note
This is deprecated. It's disabled by default in `v0.10.0` and will be removed in the next minor. Consider use [`transformerNotationHighlight`](https://shikiji.netlify.app/packages/transformers#transformernotationhighlight) instead.
:::

In addition to the features of `shikiji`, this plugin also supports line highlighting. You can specify line numbers to highlight after the language name in the format `{<line-numbers>}` - a comma separated list of `<line-number>`s, wrapped in curly braces. Each line number can be a single number (e.g. `{2}` highlights line 2 and `{1,4}` highlights lines 1 and 4) or a range (e.g. `{5-7}` highlights lines 1 through 7, and `{1-3,5-6}` highlights lines 1 through 3 and 5 through 6). For example:

````md
Expand Down
5 changes: 3 additions & 2 deletions packages/rehype-shikiji/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export interface RehypeShikijiExtraOptions {
/**
* Add `highlighted` class to lines defined in after codeblock
*
* @default true
* @deprecated Use [transformerNotationHighlight](https://shikiji.netlify.app/packages/transformers#transformernotationhighlight) instead
* @default false
*/
highlightLines?: boolean | string

Expand Down Expand Up @@ -62,7 +63,7 @@ const rehypeShikijiFromHighlighter: Plugin<[HighlighterGeneric<any, any>, Rehype
options,
) {
const {
highlightLines = true,
highlightLines = false,
addLanguageClass = false,
parseMetaString,
cache,
Expand Down

0 comments on commit fe0e4cb

Please sign in to comment.