Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vuepress/markdown

Package Overview
Dependencies
Maintainers
7
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vuepress/markdown - npm Package Compare versions

Comparing version 2.0.0-beta.22 to 2.0.0-beta.23

5

lib/plugins/codePlugin/codePlugin.d.ts

@@ -9,4 +9,7 @@ import type { PluginWithOptions } from 'markdown-it';

* Enable line numbers or not
*
* - A `boolean` value is to enable line numbers or not.
* - A `number` value is the minimum number of lines to enable line numbers
*/
lineNumbers?: boolean;
lineNumbers?: boolean | number;
/**

@@ -13,0 +16,0 @@ * Wrap the `<pre>` tag with an extra `<div>` or not. Do not disable it unless you

30

lib/plugins/codePlugin/codePlugin.js

@@ -18,19 +18,8 @@ "use strict";

const info = token.info ? md.utils.unescapeAll(token.info).trim() : '';
// resolve highlight line ranges from token info
let highlightLinesRanges = null;
if (highlightLines) {
highlightLinesRanges = resolveHighlightLines_1.resolveHighlightLines(info);
}
// resolve line-numbers mark from token info
const useLineNumbers = (_a = resolveLineNumbers_1.resolveLineNumbers(info)) !== null && _a !== void 0 ? _a : lineNumbers;
// resolve v-pre mark from token info
const useVPre = (_b = resolveVPre_1.resolveVPre(info)) !== null && _b !== void 0 ? _b : vPre;
// resolve language from token info
const language = resolveLanguage_1.resolveLanguage(info);
// the result of code and lang
let code = token.content;
// try to highlight code
code =
((_c = options.highlight) === null || _c === void 0 ? void 0 : _c.call(options, code, language.name, '')) || md.utils.escapeHtml(code);
const languageClass = `${options.langPrefix}${language.name}`;
// try to get highlighted code
const code = ((_a = options.highlight) === null || _a === void 0 ? void 0 : _a.call(options, token.content, language.name, '')) ||
md.utils.escapeHtml(token.content);
// wrap highlighted code with `<pre>` and `<code>`

@@ -40,2 +29,4 @@ let result = code.startsWith('<pre')

: `<pre class="${languageClass}"><code>${code}</code></pre>`;
// resolve v-pre mark from token info
const useVPre = (_b = resolveVPre_1.resolveVPre(info)) !== null && _b !== void 0 ? _b : vPre;
if (useVPre) {

@@ -50,8 +41,11 @@ result = `<pre v-pre${result.slice('<pre'.length)}`;

const lines = code.split('\n').slice(0, -1);
// resolve highlight line ranges from token info
const highlightLinesRanges = highlightLines
? resolveHighlightLines_1.resolveHighlightLines(info)
: null;
// generate highlight lines
if (highlightLinesRanges) {
const ranges = highlightLinesRanges;
const highlightLinesCode = lines
.map((_, index) => {
if (resolveHighlightLines_1.isHighlightLine(index + 1, ranges)) {
if (resolveHighlightLines_1.isHighlightLine(index + 1, highlightLinesRanges)) {
return '<div class="highlight-line">&nbsp;</div>';

@@ -64,2 +58,6 @@ }

}
// resolve line-numbers mark from token info
const useLineNumbers = (_c = resolveLineNumbers_1.resolveLineNumbers(info)) !== null && _c !== void 0 ? _c : (typeof lineNumbers === 'number'
? lines.length >= lineNumbers
: lineNumbers);
// generate line numbers

@@ -66,0 +64,0 @@ if (useLineNumbers) {

@@ -21,3 +21,5 @@ "use strict";

// resolve relative path according to `filePathRelative`
relativePath = utils_1.path.join(utils_1.path.dirname(filePathRelative), rawPath);
relativePath = utils_1.path.join(
// file path may contain non-ASCII characters
utils_1.path.dirname(encodeURI(filePathRelative)), rawPath);
// resolve absolute path according to `base`

@@ -24,0 +26,0 @@ absolutePath = utils_1.path.join(base, relativePath);

{
"name": "@vuepress/markdown",
"version": "2.0.0-beta.22",
"version": "2.0.0-beta.23",
"description": "Markdown package of VuePress",

@@ -29,7 +29,7 @@ "keywords": [

"dependencies": {
"@types/markdown-it": "^12.0.2",
"@vuepress/shared": "2.0.0-beta.21",
"@vuepress/utils": "2.0.0-beta.21",
"@types/markdown-it": "^12.0.3",
"@vuepress/shared": "2.0.0-beta.23",
"@vuepress/utils": "2.0.0-beta.23",
"markdown-it": "^12.1.0",
"markdown-it-anchor": "^8.1.0",
"markdown-it-anchor": "^8.1.2",
"markdown-it-emoji": "^2.0.0",

@@ -41,3 +41,3 @@ "mdurl": "^1.0.1"

},
"gitHead": "8db8d235df8914c70c864ae3f3f66f93cfd1a457"
"gitHead": "a8fde04c51473d9b7aef1a49550f9c8f3483b645"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc