mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-21 14:13:36 +08:00
docs:更新文档
This commit is contained in:
3
node_modules/vitepress/dist/node/utils/parseHeader.d.ts
generated
vendored
Normal file
3
node_modules/vitepress/dist/node/utils/parseHeader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare const removeNonCodeWrappedHTML: (str: string) => string;
|
||||
export declare const parseHeader: (str: string) => string;
|
||||
export declare const deeplyParseHeader: (str: string) => string;
|
||||
52
node_modules/vitepress/dist/node/utils/parseHeader.js
generated
vendored
Normal file
52
node_modules/vitepress/dist/node/utils/parseHeader.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
// Since VuePress needs to extract the header from the markdown source
|
||||
// file and display it in the sidebar or title (#238), this file simply
|
||||
// removes some unnecessary elements to make header displays well at
|
||||
// sidebar or title.
|
||||
//
|
||||
// But header's parsing in the markdown content is done by the markdown
|
||||
// loader based on markdown-it. markdown-it parser will will always keep
|
||||
// HTML in headers, so in VuePress, after being parsed by the markdiwn
|
||||
// loader, the raw HTML in headers will finally be parsed by Vue-loader.
|
||||
// so that we can write HTML/Vue in the header. One exception is the HTML
|
||||
// wrapped by <code>(markdown token: '`') tag.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.deeplyParseHeader = exports.parseHeader = exports.removeNonCodeWrappedHTML = void 0;
|
||||
const parseEmojis = (str) => {
|
||||
const emojiData = require('markdown-it-emoji/lib/data/full.json');
|
||||
return String(str).replace(/:(.+?):/g, (placeholder, key) => emojiData[key] || placeholder);
|
||||
};
|
||||
const unescapeHtml = (html) => String(html)
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, "'")
|
||||
.replace(/:/g, ':')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
const removeMarkdownTokens = (str) => String(str)
|
||||
.replace(/\[(.*)\]\(.*\)/, '$1') // []()
|
||||
.replace(/(`|\*{1,3}|_)(.*?[^\\])\1/g, '$2') // `{t}` | *{t}* | **{t}** | ***{t}*** | _{t}_
|
||||
.replace(/(\\)(\*|_|`|\!)/g, '$2'); // remove escape char '\'
|
||||
const trim = (str) => str.trim();
|
||||
// This method remove the raw HTML but reserve the HTML wrapped by `<code>`.
|
||||
// e.g.
|
||||
// Input: "<a> b", Output: "b"
|
||||
// Input: "`<a>` b", Output: "`<a>` b"
|
||||
exports.removeNonCodeWrappedHTML = (str) => {
|
||||
return String(str).replace(/(^|[^><`])<.*>([^><`]|$)/g, '$1$2');
|
||||
};
|
||||
const compose = (...processors) => {
|
||||
if (processors.length === 0)
|
||||
return (input) => input;
|
||||
if (processors.length === 1)
|
||||
return processors[0];
|
||||
return processors.reduce((prev, next) => {
|
||||
return (str) => next(prev(str));
|
||||
});
|
||||
};
|
||||
// Unescape html, parse emojis and remove some md tokens.
|
||||
exports.parseHeader = compose(unescapeHtml, parseEmojis, removeMarkdownTokens, trim);
|
||||
// Also clean the html that isn't wrapped by code.
|
||||
// Because we want to support using VUE components in headers.
|
||||
// e.g. https://vuepress.vuejs.org/guide/using-vue.html#badge
|
||||
exports.deeplyParseHeader = compose(exports.removeNonCodeWrappedHTML, exports.parseHeader);
|
||||
//# sourceMappingURL=parseHeader.js.map
|
||||
1
node_modules/vitepress/dist/node/utils/parseHeader.js.map
generated
vendored
Normal file
1
node_modules/vitepress/dist/node/utils/parseHeader.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parseHeader.js","sourceRoot":"","sources":["../../../src/node/utils/parseHeader.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,uEAAuE;AACvE,oEAAoE;AACpE,oBAAoB;AACpB,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,wEAAwE;AACxE,yEAAyE;AACzE,8CAA8C;;;AAE9C,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,MAAM,SAAS,GAAG,OAAO,CAAC,sCAA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