@vuepress/markdown
Advanced tools
Comparing version 2.0.0-rc.0 to 2.0.0-rc.1
@@ -14,4 +14,4 @@ import { SfcPluginOptions } from '@mdit-vue/plugin-sfc'; | ||
export { default as anchorPlugin } from 'markdown-it-anchor'; | ||
import emojiPlugin from 'markdown-it-emoji'; | ||
export { default as emojiPlugin } from 'markdown-it-emoji'; | ||
import { Options } from 'markdown-it-emoji'; | ||
export { full as emojiPlugin } from 'markdown-it-emoji'; | ||
export { ComponentPluginOptions, componentPlugin } from '@mdit-vue/plugin-component'; | ||
@@ -24,2 +24,6 @@ export { titlePlugin } from '@mdit-vue/plugin-title'; | ||
/** | ||
* Whether to prepend base to absolute path | ||
*/ | ||
absolutePathPrependBase?: boolean; | ||
/** | ||
* Prefix to add to relative assets links | ||
@@ -52,3 +56,3 @@ */ | ||
* - Required for `lineNumbers` | ||
* - Required for language display of default theme | ||
* - Required for title display of default theme | ||
*/ | ||
@@ -75,3 +79,3 @@ preWrapper?: boolean; | ||
type EmojiPluginOptions = emojiPlugin.Options; | ||
type EmojiPluginOptions = Options; | ||
@@ -188,2 +192,2 @@ interface ImportCodePluginOptions { | ||
export { AnchorPluginOptions, AssetsPluginOptions, CodePluginOptions, EmojiPluginOptions, ImportCodePluginOptions, LinksPluginOptions, Markdown, MarkdownEnv, MarkdownHeader, MarkdownLink, MarkdownOptions, MarkdownSlugifyFunction, assetsPlugin, codePlugin, createMarkdown, importCodePlugin, linksPlugin }; | ||
export { type AnchorPluginOptions, type AssetsPluginOptions, type CodePluginOptions, type EmojiPluginOptions, type ImportCodePluginOptions, type LinksPluginOptions, type Markdown, type MarkdownEnv, type MarkdownHeader, type MarkdownLink, type MarkdownOptions, type MarkdownSlugifyFunction, assetsPlugin, codePlugin, createMarkdown, importCodePlugin, linksPlugin }; |
@@ -31,3 +31,8 @@ var __defProp = Object.defineProperty; | ||
import { decode } from "mdurl"; | ||
var resolveLink = (link, relativePathPrefix, env, strict = false) => { | ||
var resolveLink = (link, { | ||
env, | ||
absolutePathPrependBase = false, | ||
relativePathPrefix, | ||
strict = false | ||
}) => { | ||
if (link.startsWith("data:")) | ||
@@ -49,2 +54,5 @@ return link; | ||
} | ||
if (absolutePathPrependBase && env.base && link.startsWith("/")) { | ||
resolvedLink = path.join(env.base, resolvedLink); | ||
} | ||
return resolvedLink; | ||
@@ -54,3 +62,6 @@ }; | ||
// src/plugins/assetsPlugin/assetsPlugin.ts | ||
var assetsPlugin = (md, { relativePathPrefix = "@source" } = {}) => { | ||
var assetsPlugin = (md, { | ||
absolutePathPrependBase = false, | ||
relativePathPrefix = "@source" | ||
} = {}) => { | ||
const rawImageRule = md.renderer.rules.image; | ||
@@ -61,3 +72,6 @@ md.renderer.rules.image = (tokens, idx, options, env, self) => { | ||
if (link) { | ||
token.attrSet("src", resolveLink(link, relativePathPrefix, env)); | ||
token.attrSet( | ||
"src", | ||
resolveLink(link, { env, absolutePathPrependBase, relativePathPrefix }) | ||
); | ||
} | ||
@@ -69,8 +83,8 @@ return rawImageRule(tokens, idx, options, env, self); | ||
/(<img\b.*?src=)(['"])([^\2]*?)\2/gs, | ||
(_, prefix, quote, src) => `${prefix}${quote}${resolveLink( | ||
src.trim(), | ||
(_, prefix, quote, src) => `${prefix}${quote}${resolveLink(src.trim(), { | ||
env, | ||
absolutePathPrependBase, | ||
relativePathPrefix, | ||
env, | ||
true | ||
)}${quote}` | ||
strict: true | ||
})}${quote}` | ||
).replace( | ||
@@ -81,8 +95,8 @@ /(<img\b.*?srcset=)(['"])([^\2]*?)\2/gs, | ||
/^([^ ]*?)([ \n].*)?$/, | ||
(_2, url, descriptor = "") => `${resolveLink( | ||
url.trim(), | ||
(_2, url, descriptor = "") => `${resolveLink(url.trim(), { | ||
env, | ||
absolutePathPrependBase, | ||
relativePathPrefix, | ||
env, | ||
true | ||
)}${descriptor.replace(/[ \n]+/g, " ").trimEnd()}` | ||
strict: true | ||
})}${descriptor.replace(/[ \n]+/g, " ").trimEnd()}` | ||
) | ||
@@ -99,2 +113,10 @@ ).join(", ")}${quote}` | ||
// src/plugins/codePlugin/resolveAttr.ts | ||
var resolveAttr = (info, attr) => { | ||
const pattern = `\\b${attr}\\s*=\\s*(?<quote>['"])(?<content>.+?)\\k<quote>(\\s|$)`; | ||
const regex = new RegExp(pattern, "i"); | ||
const match = info.match(regex); | ||
return match?.groups?.content ?? null; | ||
}; | ||
// src/plugins/codePlugin/resolveHighlightLines.ts | ||
@@ -281,3 +303,4 @@ var resolveHighlightLines = (info) => { | ||
} | ||
result = `<div class="${languageClass}${useLineNumbers ? " line-numbers-mode" : ""}" data-ext="${language.ext}">${result}</div>`; | ||
const title = resolveAttr(info, "title") ?? language.ext; | ||
result = `<div class="${languageClass}${useLineNumbers ? " line-numbers-mode" : ""}" data-ext="${language.ext}" data-title="${title}">${result}</div>`; | ||
return result; | ||
@@ -295,3 +318,3 @@ }; | ||
// src/plugins/emojiPlugin.ts | ||
import emojiPlugin from "markdown-it-emoji"; | ||
import { full as emojiPlugin } from "markdown-it-emoji"; | ||
@@ -513,7 +536,6 @@ // src/plugins/importCodePlugin/createImportCodeBlockRule.ts | ||
slugify, | ||
permalink: anchorPlugin.permalink.ariaHidden({ | ||
permalink: anchorPlugin.permalink.headerLink({ | ||
class: "header-anchor", | ||
symbol: "#", | ||
space: true, | ||
placement: "before" | ||
// Add a span inside the link so Safari shows headings in reader view. | ||
safariReaderFix: true | ||
}), | ||
@@ -520,0 +542,0 @@ ...anchor |
{ | ||
"name": "@vuepress/markdown", | ||
"version": "2.0.0-rc.0", | ||
"version": "2.0.0-rc.1", | ||
"description": "Markdown package of VuePress", | ||
@@ -11,7 +11,7 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/vuepress/vuepress-next/issues" | ||
"url": "https://github.com/vuepress/core/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vuepress/vuepress-next.git" | ||
"url": "git+https://github.com/vuepress/core.git" | ||
}, | ||
@@ -31,18 +31,18 @@ "license": "MIT", | ||
"dependencies": { | ||
"@mdit-vue/plugin-component": "^1.0.0", | ||
"@mdit-vue/plugin-frontmatter": "^1.0.0", | ||
"@mdit-vue/plugin-headers": "^1.0.0", | ||
"@mdit-vue/plugin-sfc": "^1.0.0", | ||
"@mdit-vue/plugin-title": "^1.0.0", | ||
"@mdit-vue/plugin-toc": "^1.0.0", | ||
"@mdit-vue/shared": "^1.0.0", | ||
"@mdit-vue/types": "^1.0.0", | ||
"@types/markdown-it": "^13.0.6", | ||
"@mdit-vue/plugin-component": "^2.0.0", | ||
"@mdit-vue/plugin-frontmatter": "^2.0.0", | ||
"@mdit-vue/plugin-headers": "^2.0.0", | ||
"@mdit-vue/plugin-sfc": "^2.0.0", | ||
"@mdit-vue/plugin-title": "^2.0.0", | ||
"@mdit-vue/plugin-toc": "^2.0.0", | ||
"@mdit-vue/shared": "^2.0.0", | ||
"@mdit-vue/types": "^2.0.0", | ||
"@types/markdown-it": "^13.0.7", | ||
"@types/markdown-it-emoji": "^2.0.4", | ||
"markdown-it": "^13.0.2", | ||
"markdown-it": "^14.0.0", | ||
"markdown-it-anchor": "^8.6.7", | ||
"markdown-it-emoji": "^2.0.2", | ||
"mdurl": "^1.0.1", | ||
"@vuepress/shared": "2.0.0-rc.0", | ||
"@vuepress/utils": "2.0.0-rc.0" | ||
"markdown-it-emoji": "^3.0.0", | ||
"mdurl": "^2.0.0", | ||
"@vuepress/shared": "2.0.0-rc.1", | ||
"@vuepress/utils": "2.0.0-rc.1" | ||
}, | ||
@@ -67,3 +67,3 @@ "devDependencies": { | ||
"target": "es2022", | ||
"tsconfig": "../tsconfig.dts.json" | ||
"tsconfig": "../../tsconfig.dts.json" | ||
}, | ||
@@ -70,0 +70,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
26209
5
758
0
13
+ Added@mdit-vue/plugin-component@2.1.3(transitive)
+ Added@mdit-vue/plugin-frontmatter@2.1.3(transitive)
+ Added@mdit-vue/plugin-headers@2.1.3(transitive)
+ Added@mdit-vue/plugin-sfc@2.1.3(transitive)
+ Added@mdit-vue/plugin-title@2.1.3(transitive)
+ Added@mdit-vue/plugin-toc@2.1.3(transitive)
+ Added@mdit-vue/shared@2.1.3(transitive)
+ Added@mdit-vue/types@2.1.0(transitive)
+ Added@types/linkify-it@5.0.0(transitive)
+ Added@types/markdown-it@14.1.2(transitive)
+ Added@types/mdurl@2.0.0(transitive)
+ Added@vuepress/shared@2.0.0-rc.1(transitive)
+ Added@vuepress/utils@2.0.0-rc.1(transitive)
+ Addedcli-cursor@5.0.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedget-east-asian-width@1.3.0(transitive)
+ Addedis-unicode-supported@2.1.0(transitive)
+ Addedlinkify-it@5.0.0(transitive)
+ Addedlog-symbols@6.0.0(transitive)
+ Addedmarkdown-it@14.1.0(transitive)
+ Addedmarkdown-it-emoji@3.0.0(transitive)
+ Addedmdurl@2.0.0(transitive)
+ Addedmimic-function@5.0.1(transitive)
+ Addedonetime@7.0.0(transitive)
+ Addedora@8.1.0(transitive)
+ Addedpunycode.js@2.3.1(transitive)
+ Addedrestore-cursor@5.1.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstdin-discarder@0.2.2(transitive)
+ Addedstring-width@7.2.0(transitive)
+ Addeduc.micro@2.1.0(transitive)
- Removed@mdit-vue/plugin-component@1.0.0(transitive)
- Removed@mdit-vue/plugin-frontmatter@1.0.0(transitive)
- Removed@mdit-vue/plugin-headers@1.0.0(transitive)
- Removed@mdit-vue/plugin-sfc@1.0.0(transitive)
- Removed@mdit-vue/plugin-title@1.0.0(transitive)
- Removed@mdit-vue/plugin-toc@1.0.0(transitive)
- Removed@mdit-vue/shared@1.0.0(transitive)
- Removed@mdit-vue/types@1.0.0(transitive)
- Removed@vue/shared@3.5.12(transitive)
- Removed@vuepress/shared@2.0.0-rc.0(transitive)
- Removed@vuepress/utils@2.0.0-rc.0(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbl@5.1.0(transitive)
- Removedbuffer@6.0.3(transitive)
- Removedcli-cursor@4.0.0(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedentities@3.0.1(transitive)
- Removedieee754@1.2.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedlinkify-it@4.0.1(transitive)
- Removedlog-symbols@5.1.0(transitive)
- Removedmarkdown-it@13.0.2(transitive)
- Removedmarkdown-it-emoji@2.0.2(transitive)
- Removedmdurl@1.0.1(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedonetime@5.1.2(transitive)
- Removedora@7.0.1(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedrestore-cursor@4.0.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstdin-discarder@0.1.0(transitive)
- Removedstring-width@6.1.0(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removeduc.micro@1.0.6(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updated@mdit-vue/plugin-sfc@^2.0.0
Updated@mdit-vue/plugin-toc@^2.0.0
Updated@mdit-vue/shared@^2.0.0
Updated@mdit-vue/types@^2.0.0
Updated@types/markdown-it@^13.0.7
Updated@vuepress/shared@2.0.0-rc.1
Updated@vuepress/utils@2.0.0-rc.1
Updatedmarkdown-it@^14.0.0
Updatedmarkdown-it-emoji@^3.0.0
Updatedmdurl@^2.0.0