@scalar/code-highlight
Advanced tools
Comparing version
# @scalar/code-highlight | ||
## 0.0.21 | ||
### Patch Changes | ||
- fa6afe8: chore: code formatting | ||
- 1223c1f: chore: code style | ||
## 0.0.20 | ||
@@ -4,0 +11,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { lowlightLanguageMappings } from '../constants.js'; | ||
import rehypeParse from 'rehype-parse'; | ||
@@ -6,2 +5,3 @@ import rehypeStringify from 'rehype-stringify'; | ||
import { visit } from 'unist-util-visit'; | ||
import { lowlightLanguageMappings } from '../constants.js'; | ||
import { codeBlockLinesPlugin } from './line-numbers.js'; | ||
@@ -8,0 +8,0 @@ import { rehypeHighlight } from '../rehype-highlight/rehype-highlight.js'; |
@@ -18,15 +18,13 @@ import rehypeExternalLinks from 'rehype-external-links'; | ||
*/ | ||
const transformNodes = function (options, | ||
const transformNodes = (options, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
..._ignored) { | ||
return (tree) => { | ||
if (!options?.transform || !options?.type) { | ||
return; | ||
} | ||
visit(tree, options?.type, (node) => { | ||
options?.transform ? options?.transform(node) : node; | ||
return SKIP; | ||
}); | ||
..._ignored) => (tree) => { | ||
if (!options?.transform || !options?.type) { | ||
return; | ||
}; | ||
} | ||
visit(tree, options?.type, (node) => { | ||
options?.transform ? options?.transform(node) : node; | ||
return SKIP; | ||
}); | ||
return; | ||
}; | ||
@@ -33,0 +31,0 @@ /** |
import type { Root } from 'hast'; | ||
import { type LanguageFn, createLowlight } from 'lowlight'; | ||
import { createLowlight, type LanguageFn } from 'lowlight'; | ||
import type { VFile } from 'vfile'; | ||
@@ -4,0 +4,0 @@ type HighlightOptions = { |
@@ -30,4 +30,4 @@ import { toText } from 'hast-util-to-text'; | ||
/** Transform.*/ | ||
return function (tree, file) { | ||
visit(tree, 'element', function (node, _, parent) { | ||
return (tree, file) => { | ||
visit(tree, 'element', (node, _, parent) => { | ||
if (node.tagName !== 'code' || | ||
@@ -34,0 +34,0 @@ !parent || |
@@ -19,3 +19,3 @@ { | ||
], | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"engines": { | ||
@@ -96,4 +96,4 @@ "node": ">=18" | ||
"vue": "^3.5.12", | ||
"@scalar/build-tooling": "0.1.12", | ||
"@scalar/themes": "0.9.61" | ||
"@scalar/build-tooling": "0.1.13", | ||
"@scalar/themes": "0.9.67" | ||
}, | ||
@@ -100,0 +100,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
44112
0.05%1081
-0.18%