@abreen/tada 1.5.5 → 1.5.7
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.
package/build/toc-plugin.ts
CHANGED
|
@@ -67,10 +67,12 @@ export function tocPlugin(md: MarkdownIt): void {
|
|
|
67
67
|
const parentIsSection = depth === 1 && containerStack[0] === 'section';
|
|
68
68
|
|
|
69
69
|
if (depth === 0 || parentIsSection) {
|
|
70
|
-
const match = token.info
|
|
70
|
+
const match = token.info
|
|
71
|
+
.trim()
|
|
72
|
+
.match(/^(note|warning)(?:\s+"(.+)"|\s+(.+))?$/);
|
|
71
73
|
if (match) {
|
|
72
74
|
const type = match[1];
|
|
73
|
-
let title = match[2]?.trim();
|
|
75
|
+
let title = (match[2] || match[3])?.trim();
|
|
74
76
|
if (title) {
|
|
75
77
|
title = md.utils.escapeHtml(curlyQuote(title));
|
|
76
78
|
} else {
|
package/build/utils/markdown.ts
CHANGED
|
@@ -128,7 +128,7 @@ export function createMarkdown(
|
|
|
128
128
|
markdown.use(markdownItContainer, 'alert', {
|
|
129
129
|
marker: '!',
|
|
130
130
|
validate: function (params: string) {
|
|
131
|
-
return !!params.trim().match(/^(note|warning)
|
|
131
|
+
return !!params.trim().match(/^(note|warning)(?:\s+"(.+)"|\s+(.+))?$/);
|
|
132
132
|
},
|
|
133
133
|
render: function (
|
|
134
134
|
tokens: Token[],
|
|
@@ -138,7 +138,7 @@ export function createMarkdown(
|
|
|
138
138
|
) {
|
|
139
139
|
const matches = tokens[idx].info
|
|
140
140
|
.trim()
|
|
141
|
-
.match(/^(note|warning)
|
|
141
|
+
.match(/^(note|warning)(?:\s+"(.+)"|\s+(.+))?$/);
|
|
142
142
|
|
|
143
143
|
if (tokens[idx].nesting === 1) {
|
|
144
144
|
const classNames = ['alert'];
|
|
@@ -147,7 +147,7 @@ export function createMarkdown(
|
|
|
147
147
|
classNames.push(type);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
const title = matches && matches[2]?.trim();
|
|
150
|
+
const title = matches && (matches[2] || matches[3])?.trim();
|
|
151
151
|
const displayTitle = title
|
|
152
152
|
? markdown.utils.escapeHtml(curlyQuote(title))
|
|
153
153
|
: capitalize(type || '');
|
package/package.json
CHANGED