vitepress 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { siteDataRef } from './data';
2
2
  import { inBrowser, EXTERNAL_URL_RE, sanitizeFileName } from '../shared';
3
3
  import { h, onMounted, onUnmounted, shallowRef } from 'vue';
4
- export { inBrowser } from '../shared';
4
+ export { inBrowser, escapeHtml as _escapeHtml } from '../shared';
5
5
  /**
6
6
  * Join two paths by resolving the slash collision.
7
7
  */
@@ -4,6 +4,10 @@ import { PageData, Awaitable, SiteData } from '../../types/shared.js';
4
4
  export { HeadConfig, Header, PageData, SiteData } from '../../types/shared.js';
5
5
 
6
6
  declare const inBrowser: boolean;
7
+ /**
8
+ * @internal
9
+ */
10
+ declare function escapeHtml(str: string): string;
7
11
 
8
12
  interface Route {
9
13
  path: string;
@@ -122,4 +126,4 @@ declare const Content: vue.DefineComponent<{
122
126
  as: string | Record<string, any>;
123
127
  }, {}>;
124
128
 
125
- export { Content, type EnhanceAppContext, type Route, type Router, type Theme, type VitePressData, dataSymbol, defineClientComponent, getScrollOffset, inBrowser, onContentUpdated, useData, useRoute, useRouter, withBase };
129
+ export { Content, type EnhanceAppContext, type Route, type Router, type Theme, type VitePressData, escapeHtml as _escapeHtml, dataSymbol, defineClientComponent, getScrollOffset, inBrowser, onContentUpdated, useData, useRoute, useRouter, withBase };
@@ -4,6 +4,6 @@
4
4
  export { useData, dataSymbol } from './app/data';
5
5
  export { useRoute, useRouter } from './app/router';
6
6
  // utilities
7
- export { inBrowser, onContentUpdated, defineClientComponent, withBase, getScrollOffset } from './app/utils';
7
+ export { inBrowser, onContentUpdated, defineClientComponent, withBase, getScrollOffset, _escapeHtml } from './app/utils';
8
8
  // components
9
9
  export { Content } from './app/components/Content';
@@ -140,3 +140,13 @@ export function treatAsHtml(filename) {
140
140
  export function escapeRegExp(str) {
141
141
  return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
142
142
  }
143
+ /**
144
+ * @internal
145
+ */
146
+ export function escapeHtml(str) {
147
+ return str
148
+ .replace(/</g, '&lt;')
149
+ .replace(/>/g, '&gt;')
150
+ .replace(/"/g, '&quot;')
151
+ .replace(/&(?![\w#]+;)/g, '&amp;');
152
+ }
@@ -30,7 +30,6 @@ useActiveAnchor(container, marker)
30
30
  class="VPDocAsideOutline"
31
31
  :class="{ 'has-outline': headers.length > 0 }"
32
32
  ref="container"
33
- role="navigation"
34
33
  >
35
34
  <div class="content">
36
35
  <div class="outline-marker" ref="marker" />
package/dist/node/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-DF70M2uf.js';
1
+ import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-BwR5EPUJ.js';
2
2
  import { createLogger } from 'vite';
3
3
  import 'path';
4
4
  import 'shiki';
@@ -1,7 +1,7 @@
1
1
  import { normalizePath } from 'vite';
2
2
  export { loadEnv } from 'vite';
3
- import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-DF70M2uf.js';
4
- export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-DF70M2uf.js';
3
+ import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-BwR5EPUJ.js';
4
+ export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-BwR5EPUJ.js';
5
5
  import path from 'path';
6
6
  import 'crypto';
7
7
  import 'module';
@@ -3743,7 +3743,7 @@ class AST {
3743
3743
  * that exact character. In this mode, `\` is _not_ escaped, because it is
3744
3744
  * not interpreted as a magic character, but instead as a path separator.
3745
3745
  */
3746
- const escape$4 = (s, { windowsPathsNoEscape = false, } = {}) => {
3746
+ const escape$3 = (s, { windowsPathsNoEscape = false, } = {}) => {
3747
3747
  // don't need to escape +@! because we escape the parens
3748
3748
  // that make those magic, and escaping ! as [!] isn't valid,
3749
3749
  // because [!]] is a valid glob class meaning not ']'.
@@ -4740,7 +4740,7 @@ class Minimatch {
4740
4740
  /* c8 ignore stop */
4741
4741
  minimatch.AST = AST;
4742
4742
  minimatch.Minimatch = Minimatch;
4743
- minimatch.escape = escape$4;
4743
+ minimatch.escape = escape$3;
4744
4744
  minimatch.unescape = unescape;
4745
4745
 
4746
4746
  /**
@@ -10454,7 +10454,7 @@ const glob$1 = Object.assign(glob_, {
10454
10454
  iterateSync,
10455
10455
  Glob,
10456
10456
  hasMagic,
10457
- escape: escape$4,
10457
+ escape: escape$3,
10458
10458
  unescape,
10459
10459
  });
10460
10460
  glob$1.glob = glob$1;
@@ -19941,6 +19941,9 @@ function treatAsHtml(filename) {
19941
19941
  function escapeRegExp$1(str) {
19942
19942
  return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
19943
19943
  }
19944
+ function escapeHtml$1(str) {
19945
+ return str.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/&(?![\w#]+;)/g, "&amp;");
19946
+ }
19944
19947
 
19945
19948
  const debug$2 = _debug("vitepress:config");
19946
19949
  const resolve = (root, file) => normalizePath(path$q.resolve(root, `.vitepress`, file));
@@ -26695,7 +26698,7 @@ function replaceUnsafeChar$1 (ch) {
26695
26698
  return HTML_REPLACEMENTS$1[ch]
26696
26699
  }
26697
26700
 
26698
- function escapeHtml$2 (str) {
26701
+ function escapeHtml (str) {
26699
26702
  if (HTML_ESCAPE_TEST_RE$1.test(str)) {
26700
26703
  return str.replace(HTML_ESCAPE_REPLACE_RE$1, replaceUnsafeChar$1)
26701
26704
  }
@@ -26853,7 +26856,7 @@ var utils$3 = /*#__PURE__*/Object.freeze({
26853
26856
  __proto__: null,
26854
26857
  arrayReplaceAt: arrayReplaceAt,
26855
26858
  assign: assign$1,
26856
- escapeHtml: escapeHtml$2,
26859
+ escapeHtml: escapeHtml,
26857
26860
  escapeRE: escapeRE$1,
26858
26861
  fromCodePoint: fromCodePoint,
26859
26862
  has: has,
@@ -27086,7 +27089,7 @@ default_rules.code_inline = function (tokens, idx, options, env, slf) {
27086
27089
  const token = tokens[idx];
27087
27090
 
27088
27091
  return '<code' + slf.renderAttrs(token) + '>' +
27089
- escapeHtml$2(token.content) +
27092
+ escapeHtml(token.content) +
27090
27093
  '</code>'
27091
27094
  };
27092
27095
 
@@ -27094,7 +27097,7 @@ default_rules.code_block = function (tokens, idx, options, env, slf) {
27094
27097
  const token = tokens[idx];
27095
27098
 
27096
27099
  return '<pre' + slf.renderAttrs(token) + '><code>' +
27097
- escapeHtml$2(tokens[idx].content) +
27100
+ escapeHtml(tokens[idx].content) +
27098
27101
  '</code></pre>\n'
27099
27102
  };
27100
27103
 
@@ -27112,9 +27115,9 @@ default_rules.fence = function (tokens, idx, options, env, slf) {
27112
27115
 
27113
27116
  let highlighted;
27114
27117
  if (options.highlight) {
27115
- highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml$2(token.content);
27118
+ highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
27116
27119
  } else {
27117
- highlighted = escapeHtml$2(token.content);
27120
+ highlighted = escapeHtml(token.content);
27118
27121
  }
27119
27122
 
27120
27123
  if (highlighted.indexOf('<pre') === 0) {
@@ -27168,7 +27171,7 @@ default_rules.softbreak = function (tokens, idx, options /*, env */) {
27168
27171
  };
27169
27172
 
27170
27173
  default_rules.text = function (tokens, idx /*, options, env */) {
27171
- return escapeHtml$2(tokens[idx].content)
27174
+ return escapeHtml(tokens[idx].content)
27172
27175
  };
27173
27176
 
27174
27177
  default_rules.html_block = function (tokens, idx /*, options, env */) {
@@ -27228,7 +27231,7 @@ Renderer.prototype.renderAttrs = function renderAttrs (token) {
27228
27231
  result = '';
27229
27232
 
27230
27233
  for (i = 0, l = token.attrs.length; i < l; i++) {
27231
- result += ' ' + escapeHtml$2(token.attrs[i][0]) + '="' + escapeHtml$2(token.attrs[i][1]) + '"';
27234
+ result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
27232
27235
  }
27233
27236
 
27234
27237
  return result
@@ -30636,7 +30639,7 @@ for (let i = 0; i < 256; i++) { ESCAPED.push(0); }
30636
30639
  '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
30637
30640
  .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
30638
30641
 
30639
- function escape$3 (state, silent) {
30642
+ function escape$2 (state, silent) {
30640
30643
  let pos = state.pos;
30641
30644
  const max = state.posMax;
30642
30645
 
@@ -31635,7 +31638,7 @@ const _rules = [
31635
31638
  ['text', text$1],
31636
31639
  ['linkify', linkify],
31637
31640
  ['newline', newline],
31638
- ['escape', escape$3],
31641
+ ['escape', escape$2],
31639
31642
  ['backticks', backtick],
31640
31643
  ['strikethrough', r_strikethrough.tokenize],
31641
31644
  ['emphasis', r_emphasis.tokenize],
@@ -37138,7 +37141,6 @@ async function highlight(theme, options, logger = console) {
37138
37141
  {
37139
37142
  name: "vitepress:clean-up",
37140
37143
  pre(node) {
37141
- delete node.properties.tabindex;
37142
37144
  delete node.properties.style;
37143
37145
  }
37144
37146
  }
@@ -37382,9 +37384,6 @@ function text_join(state) {
37382
37384
  function getContent(token) {
37383
37385
  return token.info === "entity" ? token.markup : token.info === "escape" && token.content === "&" ? "&amp;" : token.content;
37384
37386
  }
37385
- function escapeHtml$1(str) {
37386
- return str.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
37387
- }
37388
37387
 
37389
37388
  const rawPathRegexp = /^(.+?(?:(?:\.([a-z0-9]+))?))(?:(#[\w-]+))?(?: ?(?:{(\d+(?:[,-]\d+)*)? ?(\S+)?}))? ?(?:\[(.+)\])?$/;
37390
37389
  function rawPathToToken(rawPath) {
@@ -38034,7 +38033,7 @@ var readShebang_1 = readShebang$1;
38034
38033
 
38035
38034
  const path = path$q;
38036
38035
  const resolveCommand = resolveCommand_1;
38037
- const escape$2 = _escape;
38036
+ const escape$1 = _escape;
38038
38037
  const readShebang = readShebang_1;
38039
38038
 
38040
38039
  const isWin$2 = process.platform === 'win32';
@@ -38081,8 +38080,8 @@ function parseNonShell(parsed) {
38081
38080
  parsed.command = path.normalize(parsed.command);
38082
38081
 
38083
38082
  // Escape command & arguments
38084
- parsed.command = escape$2.command(parsed.command);
38085
- parsed.args = parsed.args.map((arg) => escape$2.argument(arg, needsDoubleEscapeMetaChars));
38083
+ parsed.command = escape$1.command(parsed.command);
38084
+ parsed.args = parsed.args.map((arg) => escape$1.argument(arg, needsDoubleEscapeMetaChars));
38086
38085
 
38087
38086
  const shellCommand = [parsed.command].concat(parsed.args).join(' ');
38088
38087
 
@@ -46520,86 +46519,7 @@ async function generateSitemap(siteConfig) {
46520
46519
  });
46521
46520
  }
46522
46521
 
46523
- /*!
46524
- * escape-html
46525
- * Copyright(c) 2012-2013 TJ Holowaychuk
46526
- * Copyright(c) 2015 Andreas Lubbe
46527
- * Copyright(c) 2015 Tiancheng "Timothy" Gu
46528
- * MIT Licensed
46529
- */
46530
-
46531
- /**
46532
- * Module variables.
46533
- * @private
46534
- */
46535
-
46536
- var matchHtmlRegExp = /["'&<>]/;
46537
-
46538
- /**
46539
- * Module exports.
46540
- * @public
46541
- */
46542
-
46543
- var escapeHtml_1 = escapeHtml;
46544
-
46545
- /**
46546
- * Escape special characters in the given string of html.
46547
- *
46548
- * @param {string} string The string to escape for inserting into HTML
46549
- * @return {string}
46550
- * @public
46551
- */
46552
-
46553
- function escapeHtml(string) {
46554
- var str = '' + string;
46555
- var match = matchHtmlRegExp.exec(str);
46556
-
46557
- if (!match) {
46558
- return str;
46559
- }
46560
-
46561
- var escape;
46562
- var html = '';
46563
- var index = 0;
46564
- var lastIndex = 0;
46565
-
46566
- for (index = match.index; index < str.length; index++) {
46567
- switch (str.charCodeAt(index)) {
46568
- case 34: // "
46569
- escape = '&quot;';
46570
- break;
46571
- case 38: // &
46572
- escape = '&amp;';
46573
- break;
46574
- case 39: // '
46575
- escape = '&#39;';
46576
- break;
46577
- case 60: // <
46578
- escape = '&lt;';
46579
- break;
46580
- case 62: // >
46581
- escape = '&gt;';
46582
- break;
46583
- default:
46584
- continue;
46585
- }
46586
-
46587
- if (lastIndex !== index) {
46588
- html += str.substring(lastIndex, index);
46589
- }
46590
-
46591
- lastIndex = index + 1;
46592
- html += escape;
46593
- }
46594
-
46595
- return lastIndex !== index
46596
- ? html + str.substring(lastIndex, index)
46597
- : html;
46598
- }
46599
-
46600
- var escape$1 = /*@__PURE__*/getDefaultExportFromCjs(escapeHtml_1);
46601
-
46602
- var version = "1.2.0";
46522
+ var version = "1.2.2";
46603
46523
 
46604
46524
  async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
46605
46525
  const routePath = `/${page.replace(/\.md$/, "")}`;
@@ -46696,7 +46616,7 @@ async function renderPage(render, config, page, result, appChunk, cssChunk, asse
46696
46616
  <head>
46697
46617
  <meta charset="utf-8">
46698
46618
  ${isMetaViewportOverridden(head) ? "" : '<meta name="viewport" content="width=device-width,initial-scale=1">'}
46699
- <title>${title}</title>
46619
+ <title>${escapeHtml$1(title)}</title>
46700
46620
  ${isDescriptionOverridden(head) ? "" : `<meta name="description" content="${description}">`}
46701
46621
  <meta name="generator" content="VitePress v${version}">
46702
46622
  ${stylesheetLink}
@@ -46766,7 +46686,7 @@ async function renderHead(head) {
46766
46686
  function renderAttrs(attrs) {
46767
46687
  return Object.keys(attrs).map((key) => {
46768
46688
  if (isBooleanAttr(key)) return ` ${key}`;
46769
- return ` ${key}="${escape$1(attrs[key])}"`;
46689
+ return ` ${key}="${escapeHtml$1(attrs[key])}"`;
46770
46690
  }).join("");
46771
46691
  }
46772
46692
  function filterOutHeadDescription(head = []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Vite & Vue powered static site generator",
5
5
  "keywords": [
6
6
  "vite",
@@ -95,7 +95,6 @@
95
95
  "@rollup/plugin-replace": "^5.0.5",
96
96
  "@types/cross-spawn": "^6.0.6",
97
97
  "@types/debug": "^4.1.12",
98
- "@types/escape-html": "^1.0.4",
99
98
  "@types/fs-extra": "^11.0.4",
100
99
  "@types/lodash.template": "^4.5.3",
101
100
  "@types/mark.js": "^8.11.12",
@@ -112,7 +111,6 @@
112
111
  "cross-spawn": "^7.0.3",
113
112
  "debug": "^4.3.4",
114
113
  "esbuild": "^0.21.3",
115
- "escape-html": "^1.0.3",
116
114
  "execa": "^9.1.0",
117
115
  "fast-glob": "^3.3.2",
118
116
  "fs-extra": "^11.2.0",