rehype-highlight-code-lines 0.0.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ use(rehypeHighlightLines, HighlightLinesOptions);
|
|
|
148
148
|
|
|
149
149
|
#### `showLineNumbers`
|
|
150
150
|
|
|
151
|
-
It is a **boolean** option which is for all code
|
|
151
|
+
It is a **boolean** option which is for all code to be numbered.
|
|
152
152
|
|
|
153
153
|
By default, it is `false`.
|
|
154
154
|
|
|
@@ -158,7 +158,7 @@ use(rehypeHighlightLines, {
|
|
|
158
158
|
});
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
Now, all code blocks will become numbered
|
|
161
|
+
Now, all code blocks will become numbered. If you want to exclude a specific code block not to be numbered, use `noLineNumbers`.
|
|
162
162
|
|
|
163
163
|
**\`\`\`[language] noLineNumbers {2}**
|
|
164
164
|
|
|
@@ -203,9 +203,9 @@ use(rehypeHighlightLines, {
|
|
|
203
203
|
|
|
204
204
|
## Copying Code Block's Content Issue
|
|
205
205
|
|
|
206
|
-
When the line
|
|
206
|
+
When the line container is "div" block element, the end of line character (eol) at the end of line causes unwanted extra blank line. In order to fix the issue, I've **removed the eol when it is "div", but kept the eol when it is "span"**.
|
|
207
207
|
|
|
208
|
-
But, the lack of eol when "div" causes another issue
|
|
208
|
+
But, **the lack of the eol when "div" causes another issue.** If you implement a button for copying code block content, it doesn't work as expected since all code are printed in a single line. In order to work around the issue, you can implement an `onClick` of the `button` like below:
|
|
209
209
|
|
|
210
210
|
*I assume you use a `useRef` for `<pre>` element.*
|
|
211
211
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rehype-highlight-code-lines",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Rehype plugin to add line numbers to code blocks and allow highlighting of desired code lines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/esm/index.js",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/dedent": "^0.7.2",
|
|
50
|
-
"@types/node": "^20.14.
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^7.13.
|
|
52
|
-
"@typescript-eslint/parser": "^7.13.
|
|
50
|
+
"@types/node": "^20.14.6",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
52
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
53
53
|
"@vitest/coverage-v8": "^1.6.0",
|
|
54
54
|
"dedent": "^1.5.3",
|
|
55
55
|
"eslint": "^8.57.0",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"remark-rehype": "^11.1.0",
|
|
64
64
|
"rimraf": "^5.0.7",
|
|
65
65
|
"type-coverage": "^2.29.0",
|
|
66
|
-
"typescript": "^5.
|
|
67
|
-
"unified": "^11.0.
|
|
66
|
+
"typescript": "^5.5.2",
|
|
67
|
+
"unified": "^11.0.5",
|
|
68
68
|
"vfile": "^6.0.1",
|
|
69
69
|
"vitest": "^1.4.0"
|
|
70
70
|
},
|