From 70bf0823fcdfe43194719f30efe89b00af2a04c5 Mon Sep 17 00:00:00 2001 From: dks333 Date: Thu, 12 Jun 2025 15:28:52 -0700 Subject: [PATCH] add lang and remove line numbers --- packages/mdx/package.json | 2 +- .../mdx/src/plugins/rehype/rehypeSyntaxHighlighting.ts | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/mdx/package.json b/packages/mdx/package.json index 5bb4c22..da59575 100644 --- a/packages/mdx/package.json +++ b/packages/mdx/package.json @@ -1,6 +1,6 @@ { "name": "@mintlify/mdx", - "version": "2.0.1", + "version": "2.0.2", "description": "Markdown parser from Mintlify", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/mdx/src/plugins/rehype/rehypeSyntaxHighlighting.ts b/packages/mdx/src/plugins/rehype/rehypeSyntaxHighlighting.ts index e618bc1..31c908a 100644 --- a/packages/mdx/src/plugins/rehype/rehypeSyntaxHighlighting.ts +++ b/packages/mdx/src/plugins/rehype/rehypeSyntaxHighlighting.ts @@ -131,17 +131,14 @@ const traverseNode = ( const codeElement = hast.children[0] as Element; if (!codeElement) return; - let lineNumber = 0; - const preChild = codeElement.children[0] as Element; - const numberOfLines = lineNumber; node.data = node.data ?? {}; codeElement.data = node.data; - codeElement.properties.numberOfLines = numberOfLines; + codeElement.properties.language = lang; if (preChild) { preChild.data = node.data; - preChild.properties.numberOfLines = numberOfLines; + preChild.properties.language = lang; } parent.children.splice(index, 1, codeElement); } catch (err) {