New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rehype-highlight-code-lines

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-highlight-code-lines - npm Package Compare versions

Comparing version

to
1.0.0

12

package.json
{
"name": "rehype-highlight-code-lines",
"version": "0.0.5",
"version": "1.0.0",
"description": "Rehype plugin to add line numbers to code blocks and allow highlighting of desired code lines",

@@ -50,5 +50,5 @@ "type": "module",

"@types/dedent": "^0.7.2",
"@types/node": "^20.14.2",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"@types/node": "^20.14.6",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vitest/coverage-v8": "^1.6.0",

@@ -67,4 +67,4 @@ "dedent": "^1.5.3",

"type-coverage": "^2.29.0",
"typescript": "^5.4.5",
"unified": "^11.0.4",
"typescript": "^5.5.2",
"unified": "^11.0.5",
"vfile": "^6.0.1",

@@ -71,0 +71,0 @@ "vitest": "^1.4.0"

@@ -151,3 +151,3 @@ # rehype-highlight-code-lines

It is a **boolean** option which is for all code blocks will be numbered.
It is a **boolean** option which is for all code to be numbered.

@@ -162,3 +162,3 @@ By default, it is `false`.

Now, all code blocks will become numbered by line. If you want to exclude a specific code block not to be numbered, use `noLineNumbers`.
Now, all code blocks will become numbered. If you want to exclude a specific code block not to be numbered, use `noLineNumbers`.

@@ -208,5 +208,5 @@ **\`\`\`[language] noLineNumbers {2}**

When the line containers are "div" block element, the end of line character (eol) at the end of each line causes unwanted extra blank lines. In order to fix the issue, I've removed the eol when they are "div", but kept it when they are "span".
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"**.
But, the lack of eol when "div" causes another issue. If you implement a button for copying code block content, it doesn't work as expected as all code are printed in a single line. In order to work around the issue, you can implement an `onClick` like below:
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:

@@ -213,0 +213,0 @@ *I assume you use a `useRef` for `<pre>` element.*