mirror of https://github.com/vuejs/vitepress
The `fence` rule is disabled by default, replacing the patch we carried to stop curly attributes from consuming code block meta (line highlighting etc.). Drops both attrs patches and `@types/markdown-it-attrs`. BREAKING CHANGE: `markdown.attrs` options are now typed by `@mdit/plugin-attrs`: `leftDelimiter`, `rightDelimiter`, and `allowedAttributes` are renamed to `left`, `right`, and `allowed`. A `rule` option is available for toggling individual attribute rules (VitePress disables `fence` by default). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>pull/5335/head
parent
7c09583eaa
commit
18380b0eb7
@ -1,23 +0,0 @@
|
||||
diff --git a/index.d.ts b/index.d.ts
|
||||
index 41d4a858c6ece5a61a2088733cf8b333b45603d8..2cb19bcd8fc76ae82ebe87af742916e17f49334b 100644
|
||||
--- a/index.d.ts
|
||||
+++ b/index.d.ts
|
||||
@@ -1,3 +1,15 @@
|
||||
-import MarkdownIt = require("markdown-it");
|
||||
-declare function attrs(md: MarkdownIt): void;
|
||||
-export = attrs;
|
||||
+import type MarkdownIt from 'markdown-it'
|
||||
+
|
||||
+export interface MarkdownItAttrsOptions {
|
||||
+ /** left delimiter, default is `{`(left curly bracket) */
|
||||
+ leftDelimiter?: string
|
||||
+ /** right delimiter, default is `}`(right curly bracket) */
|
||||
+ rightDelimiter?: string
|
||||
+ /** rule of allowed attribute, empty means no limit */
|
||||
+ allowedAttributes?: (string | RegExp)[]
|
||||
+}
|
||||
+
|
||||
+export default function attrsPlugin(
|
||||
+ md: MarkdownIt,
|
||||
+ options?: MarkdownItAttrsOptions
|
||||
+): void
|
||||
@ -1,14 +0,0 @@
|
||||
diff --git a/patterns.js b/patterns.js
|
||||
index e56a3b785df29e726194f2b30e86bb19a78ef902..e1f6211b92cbb2bbbe2a3c317dd9e5f1f41ab8d1 100644
|
||||
--- a/patterns.js
|
||||
+++ b/patterns.js
|
||||
@@ -28,7 +28,8 @@ module.exports = options => {
|
||||
{
|
||||
shift: 0,
|
||||
block: true,
|
||||
- info: utils.hasDelimiters('end', options)
|
||||
+ info: utils.hasDelimiters('end', options),
|
||||
+ markup: (str) => !/^[`~]{3,}$/.test(str)
|
||||
}
|
||||
],
|
||||
transform: (tokens, i) => {
|
||||
Loading…
Reference in new issue