diff --git a/package.json b/package.json index 079ff17c..86a68bf6 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@eslint/json": "^0.14.0", "@stylistic/eslint-plugin": "^5.5.0", "@types/jest": "30.0.0", - "@types/markdown-it": "13.0.9", + "@types/markdown-it": "14.1.2", "@types/node": "24.10.0", "@types/prismjs": "1.26.5", "babel-plugin-add-module-exports": "1.0.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6bd6b2bc..dac6273d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,8 +40,8 @@ importers: specifier: 30.0.0 version: 30.0.0 '@types/markdown-it': - specifier: 13.0.9 - version: 13.0.9 + specifier: 14.1.2 + version: 14.1.2 '@types/node': specifier: 24.10.0 version: 24.10.0 @@ -1059,14 +1059,14 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/linkify-it@3.0.5': - resolution: {integrity: sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==} + '@types/linkify-it@5.0.0': + resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==} - '@types/markdown-it@13.0.9': - resolution: {integrity: sha512-1XPwR0+MgXLWfTn9gCsZ55AHOKW1WN+P9vr0PaQh5aerR9LLQXUbjfEAFhjmEmyoYFWAyuN2Mqkn40MZ4ukjBw==} + '@types/markdown-it@14.1.2': + resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==} - '@types/mdurl@1.0.5': - resolution: {integrity: sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA==} + '@types/mdurl@2.0.0': + resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==} '@types/node@24.10.0': resolution: {integrity: sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==} @@ -4706,14 +4706,14 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/linkify-it@3.0.5': {} + '@types/linkify-it@5.0.0': {} - '@types/markdown-it@13.0.9': + '@types/markdown-it@14.1.2': dependencies: - '@types/linkify-it': 3.0.5 - '@types/mdurl': 1.0.5 + '@types/linkify-it': 5.0.0 + '@types/mdurl': 2.0.0 - '@types/mdurl@1.0.5': {} + '@types/mdurl@2.0.0': {} '@types/node@24.10.0': dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..3d5d5142 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +ignoredBuiltDependencies: + - unrs-resolver diff --git a/src/index.ts b/src/index.ts index b46731a6..b97e29b8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,6 @@ import Prism, { Grammar } from 'prismjs' import loadLanguages from 'prismjs/components/' -import MarkdownIt from 'markdown-it' -import Renderer, { RenderRule } from 'markdown-it/lib/renderer' -import StateCore from 'markdown-it/lib/rules_core/state_core' -import Token from 'markdown-it/lib/token' +import MarkdownIt, { Renderer, StateCore, Token } from 'markdown-it' const SPECIFIED_LANGUAGE_META_KEY = 'de.joshuagleitze.markdown-it-prism.specifiedLanguage' type SelectedPrismLanguage = [string, Grammar | undefined] @@ -196,7 +193,7 @@ function extractInlineCodeSpecifiedLanguage(inlineCodeToken: Token, followingTok * @param existingRule * The previously configured render rule for fenced code blocks. */ -function applyCodeAttributes(markdownit: MarkdownIt, options: Options, existingRule: RenderRule): RenderRule { +function applyCodeAttributes(markdownit: MarkdownIt, options: Options, existingRule: Renderer.RenderRule): Renderer.RenderRule { return (tokens, idx, renderOptions, env, self) => { const fenceToken = tokens[idx] const info = fenceToken.info ? markdownit.utils.unescapeAll(fenceToken.info).trim() : '' @@ -229,7 +226,7 @@ function applyCodeAttributes(markdownit: MarkdownIt, options: Options, existingR * @param existingRule * The previously configured render rule for inline code. */ -function renderInlineCode(markdownit: MarkdownIt, options: Options, existingRule: RenderRule): RenderRule { +function renderInlineCode(markdownit: MarkdownIt, options: Options, existingRule: Renderer.RenderRule): Renderer.RenderRule { return (tokens, idx, renderOptions, env, self) => { const inlineCodeToken = tokens[idx] const specifiedLanguage = inlineCodeToken.meta ? (inlineCodeToken.meta[SPECIFIED_LANGUAGE_META_KEY] || '') : ''