@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.
@@ -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.trim().match(/^(note|warning)\s*"?(.+)?"?$/);
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 {
@@ -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)\s*"?(.+)?"?$/);
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)\s*"?(.+)?"?$/);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abreen/tada",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "type": "module",
5
5
  "description": "A static site generator",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@ export async function mountPerPageComponents(
39
39
  }
40
40
  resolve();
41
41
  } catch (err) {
42
- if (__IS_DEV__) {
42
+ if (typeof __IS_DEV__ !== 'undefined' && __IS_DEV__) {
43
43
  console.error(`Failed to mount ${name} component:`, String(err));
44
44
  }
45
45
  reject();