@vuepress/markdown
Advanced tools
Comparing version 2.0.0-beta.48 to 2.0.0-beta.49
export * from './markdown'; | ||
export * from './plugins'; | ||
export * from './types'; | ||
export * from './utils'; |
@@ -20,2 +20,1 @@ "use strict"; | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./utils"), exports); |
@@ -5,2 +5,2 @@ import type { Markdown, MarkdownOptions } from './types'; | ||
*/ | ||
export declare const createMarkdown: ({ anchor, assets, code, customComponent, emoji, extractHeaders, extractTitle, hoistTags, importCode, links, slugify, toc, ...markdownItOptions }?: MarkdownOptions) => Markdown; | ||
export declare const createMarkdown: ({ anchor, assets, code, component, emoji, frontmatter, headers, title, importCode, links, sfc, slugify, toc, ...markdownItOptions }?: MarkdownOptions) => Markdown; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createMarkdown = void 0; | ||
const shared_1 = require("@mdit-vue/shared"); | ||
const MarkdownIt = require("markdown-it"); | ||
const plugins_1 = require("./plugins"); | ||
const utils_1 = require("./utils"); | ||
/** | ||
* Create vuepress customized markdown-it instance | ||
*/ | ||
const createMarkdown = ({ anchor, assets, code, customComponent, emoji, extractHeaders, extractTitle, hoistTags, importCode, links, slugify = utils_1.vuepressSlugify, toc, ...markdownItOptions } = {}) => { | ||
const createMarkdown = ({ anchor, assets, code, component, emoji, frontmatter, headers, title, importCode, links, sfc, slugify = shared_1.slugify, toc, ...markdownItOptions } = {}) => { | ||
// create raw markdown-it instance | ||
@@ -43,3 +43,3 @@ const md = MarkdownIt({ | ||
slugify, | ||
linkTag: 'RouterLink', | ||
linkTag: 'router-link', | ||
...toc, | ||
@@ -49,12 +49,12 @@ }); | ||
// extract headers into env | ||
if (extractHeaders !== false) { | ||
md.use(plugins_1.extractHeadersPlugin, { | ||
if (headers !== false) { | ||
md.use(plugins_1.headersPlugin, { | ||
level: [2, 3], | ||
slugify, | ||
...extractHeaders, | ||
...headers, | ||
}); | ||
} | ||
// extract title into env | ||
if (extractTitle !== false) { | ||
md.use(plugins_1.extractTitlePlugin); | ||
if (title !== false) { | ||
md.use(plugins_1.titlePlugin); | ||
} | ||
@@ -64,6 +64,17 @@ // ===================================================== | ||
// and have no conflicts, so the order is not important | ||
// treat unknown html tags as custom components | ||
if (customComponent !== false) { | ||
md.use(plugins_1.customComponentPlugin); | ||
// treat unknown html tags as components | ||
if (component !== false) { | ||
md.use(plugins_1.componentPlugin); | ||
} | ||
// extract frontmatter and excerpt into env | ||
if (frontmatter !== false) { | ||
md.use(plugins_1.frontmatterPlugin, { | ||
...frontmatter, | ||
grayMatterOptions: { | ||
excerpt: true, | ||
excerpt_separator: '<!-- more -->', | ||
...frontmatter?.grayMatterOptions, | ||
}, | ||
}); | ||
} | ||
// replace relative link of assets with absolute link | ||
@@ -73,5 +84,5 @@ if (assets !== false) { | ||
} | ||
// hoist vue SFC blocks and extract them into env | ||
if (hoistTags !== false) { | ||
md.use(plugins_1.hoistTagsPlugin, hoistTags); | ||
// extract vue SFC blocks into env | ||
if (sfc !== false) { | ||
md.use(plugins_1.sfcPlugin, sfc); | ||
} | ||
@@ -78,0 +89,0 @@ // process external and internal links |
@@ -1,25 +0,3 @@ | ||
import type { PluginWithOptions } from 'markdown-it'; | ||
/** | ||
* Options for markdown-it-emoji | ||
* | ||
* @see https://github.com/markdown-it/markdown-it-emoji | ||
*/ | ||
export interface EmojiPluginOptions { | ||
/** | ||
* rewrite available emoji definitions | ||
* | ||
* @example `{ name1: char1, name2: char2, ... }` | ||
*/ | ||
defs?: Record<string, string>; | ||
/** | ||
* disable all emojis except whitelisted | ||
*/ | ||
enabled?: string[]; | ||
/** | ||
* rewrite default shortcuts | ||
* | ||
* @example `{ "smile": [ ":)", ":-)" ], "laughing": ":D" }` | ||
*/ | ||
shortcuts?: Record<string, string | string[]>; | ||
} | ||
export declare const emojiPlugin: PluginWithOptions<EmojiPluginOptions>; | ||
import * as emojiPlugin from 'markdown-it-emoji'; | ||
export declare type EmojiPluginOptions = emojiPlugin.Options; | ||
export { emojiPlugin }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.emojiPlugin = void 0; | ||
const rawEmojiPlugin = require("markdown-it-emoji"); | ||
exports.emojiPlugin = rawEmojiPlugin; | ||
const emojiPlugin = require("markdown-it-emoji"); | ||
exports.emojiPlugin = emojiPlugin; |
@@ -0,11 +1,12 @@ | ||
export * from '@mdit-vue/plugin-component'; | ||
export * from '@mdit-vue/plugin-frontmatter'; | ||
export * from '@mdit-vue/plugin-headers'; | ||
export * from '@mdit-vue/plugin-sfc'; | ||
export * from '@mdit-vue/plugin-title'; | ||
export * from '@mdit-vue/plugin-toc'; | ||
export * from './anchorPlugin'; | ||
export * from './assetsPlugin'; | ||
export * from './codePlugin'; | ||
export * from './customComponentPlugin'; | ||
export * from './emojiPlugin'; | ||
export * from './extractHeadersPlugin'; | ||
export * from './extractTitlePlugin'; | ||
export * from './hoistTagsPlugin'; | ||
export * from './importCodePlugin'; | ||
export * from './linksPlugin'; | ||
export * from './tocPlugin'; |
@@ -17,12 +17,13 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("@mdit-vue/plugin-component"), exports); | ||
__exportStar(require("@mdit-vue/plugin-frontmatter"), exports); | ||
__exportStar(require("@mdit-vue/plugin-headers"), exports); | ||
__exportStar(require("@mdit-vue/plugin-sfc"), exports); | ||
__exportStar(require("@mdit-vue/plugin-title"), exports); | ||
__exportStar(require("@mdit-vue/plugin-toc"), exports); | ||
__exportStar(require("./anchorPlugin"), exports); | ||
__exportStar(require("./assetsPlugin"), exports); | ||
__exportStar(require("./codePlugin"), exports); | ||
__exportStar(require("./customComponentPlugin"), exports); | ||
__exportStar(require("./emojiPlugin"), exports); | ||
__exportStar(require("./extractHeadersPlugin"), exports); | ||
__exportStar(require("./extractTitlePlugin"), exports); | ||
__exportStar(require("./hoistTagsPlugin"), exports); | ||
__exportStar(require("./importCodePlugin"), exports); | ||
__exportStar(require("./linksPlugin"), exports); | ||
__exportStar(require("./tocPlugin"), exports); |
@@ -0,4 +1,5 @@ | ||
import type { MarkdownItEnv } from '@mdit-vue/types'; | ||
import type { PageFrontmatter, PageHeader } from '@vuepress/shared'; | ||
import type * as MarkdownIt from 'markdown-it'; | ||
import type { AnchorPluginOptions, AssetsPluginOptions, CodePluginOptions, EmojiPluginOptions, ExtractHeadersPluginOptions, HoistTagsPluginOptions, ImportCodePluginOptions, LinksPluginOptions, TocPluginOptions } from './plugins'; | ||
import type { AnchorPluginOptions, AssetsPluginOptions, CodePluginOptions, EmojiPluginOptions, FrontmatterPluginOptions, HeadersPluginOptions, ImportCodePluginOptions, LinksPluginOptions, SfcPluginOptions, TocPluginOptions } from './plugins'; | ||
export declare type Markdown = MarkdownIt; | ||
@@ -9,9 +10,10 @@ export interface MarkdownOptions extends MarkdownIt.Options { | ||
code?: false | CodePluginOptions; | ||
customComponent?: false; | ||
component?: false; | ||
emoji?: false | EmojiPluginOptions; | ||
extractHeaders?: false | ExtractHeadersPluginOptions; | ||
extractTitle?: false; | ||
hoistTags?: false | HoistTagsPluginOptions; | ||
frontmatter?: false | FrontmatterPluginOptions; | ||
headers?: false | HeadersPluginOptions; | ||
title?: false; | ||
importCode?: false | ImportCodePluginOptions; | ||
links?: false | LinksPluginOptions; | ||
sfc?: false | SfcPluginOptions; | ||
slugify?: MarkdownSlugifyFunction; | ||
@@ -41,3 +43,3 @@ toc?: false | TocPluginOptions; | ||
*/ | ||
export interface MarkdownEnv { | ||
export interface MarkdownEnv extends MarkdownItEnv { | ||
/** | ||
@@ -60,10 +62,2 @@ * Base / publicPath of current site | ||
/** | ||
* Headers that extracted by extractHeadersPlugin | ||
*/ | ||
headers?: MarkdownHeader[]; | ||
/** | ||
* Hoisted tags that extracted by hoistTagsPlugin | ||
*/ | ||
hoistedTags?: string[]; | ||
/** | ||
* Imported file that extracted by importCodePlugin | ||
@@ -76,6 +70,2 @@ */ | ||
links?: MarkdownLink[]; | ||
/** | ||
* Title that extracted by extractTitlePlugin | ||
*/ | ||
title?: string; | ||
} | ||
@@ -82,0 +72,0 @@ /** |
{ | ||
"name": "@vuepress/markdown", | ||
"version": "2.0.0-beta.48", | ||
"version": "2.0.0-beta.49", | ||
"description": "Markdown package of VuePress", | ||
@@ -25,5 +25,14 @@ "keywords": [ | ||
"dependencies": { | ||
"@mdit-vue/plugin-component": "^0.6.0", | ||
"@mdit-vue/plugin-frontmatter": "^0.6.0", | ||
"@mdit-vue/plugin-headers": "^0.6.0", | ||
"@mdit-vue/plugin-sfc": "^0.6.0", | ||
"@mdit-vue/plugin-title": "^0.6.0", | ||
"@mdit-vue/plugin-toc": "^0.6.0", | ||
"@mdit-vue/shared": "^0.6.0", | ||
"@mdit-vue/types": "^0.6.0", | ||
"@types/markdown-it": "^12.2.3", | ||
"@vuepress/shared": "2.0.0-beta.48", | ||
"@vuepress/utils": "2.0.0-beta.48", | ||
"@types/markdown-it-emoji": "^2.0.2", | ||
"@vuepress/shared": "2.0.0-beta.49", | ||
"@vuepress/utils": "2.0.0-beta.49", | ||
"markdown-it": "^13.0.1", | ||
@@ -30,0 +39,0 @@ "markdown-it-anchor": "^8.6.4", |
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
42904
16
50
1087
+ Added@mdit-vue/plugin-sfc@^0.6.0
+ Added@mdit-vue/plugin-toc@^0.6.0
+ Added@mdit-vue/shared@^0.6.0
+ Added@mdit-vue/types@^0.6.0
+ Added@mdit-vue/plugin-component@0.6.0(transitive)
+ Added@mdit-vue/plugin-frontmatter@0.6.0(transitive)
+ Added@mdit-vue/plugin-headers@0.6.0(transitive)
+ Added@mdit-vue/plugin-sfc@0.6.0(transitive)
+ Added@mdit-vue/plugin-title@0.6.0(transitive)
+ Added@mdit-vue/plugin-toc@0.6.0(transitive)
+ Added@mdit-vue/shared@0.6.0(transitive)
+ Added@mdit-vue/types@0.6.0(transitive)
+ Added@types/markdown-it-emoji@2.0.5(transitive)
+ Added@vuepress/shared@2.0.0-beta.49(transitive)
+ Added@vuepress/utils@2.0.0-beta.49(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedextend-shallow@2.0.1(transitive)
+ Addedgray-matter@4.0.3(transitive)
+ Addedis-extendable@0.1.1(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedsection-matter@1.0.0(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstrip-bom-string@1.0.0(transitive)
- Removed@vuepress/shared@2.0.0-beta.48(transitive)
- Removed@vuepress/utils@2.0.0-beta.48(transitive)