@clarusjs/content 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -270,7 +270,21 @@ function pageHead(data, title) {
270
270
  return tags.length || raws.length || ld.length ? `<cl-head>${staticHtml(tags.join(''))}${raws.join('')}${ld.join('')}</cl-head>` : '';
271
271
  }
272
272
  function staticHtml(html) {
273
- return html.replace(/\{\{/g, '&#123;&#123;').replace(/@/g, '&#64;');
273
+ const inertText = (s) => s.replace(/\{\{/g, '&#123;&#123;').replace(/@/g, '&#64;');
274
+ let out = '';
275
+ let at = 0;
276
+ for (const m of html.matchAll(/<([\w-]+)(\s[^>]*)?>/g)) {
277
+ const names = (m[2] ?? '').replace(/=\s*("[^"]*"|'[^']*'|[^\s>]*)/g, '');
278
+ if (m.index < at || !/(^|\s)verbatim(?=[\s/]|$)/.test(names))
279
+ continue;
280
+ const start = m.index + m[0].length;
281
+ const close = html.indexOf(`</${m[1]}>`, start);
282
+ if (close === -1)
283
+ continue;
284
+ out += inertText(html.slice(at, start)) + html.slice(start, close);
285
+ at = close;
286
+ }
287
+ return out + inertText(html.slice(at));
274
288
  }
275
289
  function protectTags(body, components, saved) {
276
290
  const code = /(?:^|\n)[ \t]*(`{3,}|~{3,})[^\n]*\n[\s\S]*?(?:\n[ \t]*\1[`~]*[ \t\r]*(?=\n|$)|$)|(`+)[\s\S]*?[^`]\2(?!`)/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarusjs/content",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Markdown pages for clarusjs: frontmatter, layouts, components in Markdown, rendered to static HTML at build time.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  "access": "public"
20
20
  },
21
21
  "peerDependencies": {
22
- "clarusjs": "^0.8.0"
22
+ "clarusjs": "^0.8.1"
23
23
  },
24
24
  "engines": {
25
25
  "node": "^22.12.0 || ^24.0.0 || >=26.0.0"
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@types/markdown-it": "^14.2.0",
52
52
  "@types/node": "^26.6.6",
53
- "clarusjs": "^0.8.0",
53
+ "clarusjs": "^0.8.1",
54
54
  "typescript": "^7.0.2",
55
55
  "vite": "^8.3.8",
56
56
  "vitest": "^5.1.1"