@blaaiz/docs-core 0.7.1 → 0.7.3

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/dist/generator.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parseNavigation, planDocsTree, mergeOpenApiDocuments, hasOpenApi } from './chunk-II3RGD6Q.js';
1
+ import { parseNavigation, planDocsTree, mergeOpenApiDocuments, hasOpenApi } from './chunk-KIE7J526.js';
2
2
  import { readFile, rm, mkdir, writeFile } from 'fs/promises';
3
3
  import path from 'path';
4
4
 
package/dist/index.cjs CHANGED
@@ -2192,12 +2192,20 @@ function isGeneratedApiPage(frontmatter) {
2192
2192
  return /^_openapi\s*:/m.test(frontmatter);
2193
2193
  }
2194
2194
  function cleanBody(body) {
2195
- const segments = body.split(/(```[\s\S]*?```)/g);
2195
+ const segments = body.split(/(```[\s\S]*?```|`[^`\n]+`)/g);
2196
2196
  const cleaned = segments.map(
2197
- (segment) => segment.startsWith("```") ? segment : segment.replace(/^\s*(import|export)\s.*$/gm, "").replace(/\{\/\*[\s\S]*?\*\/\}/g, "").replace(/<\/?[A-Za-z][^>]*>/g, "")
2197
+ (segment) => segment.startsWith("`") ? segment : segment.replace(/^\s*(import|export)\s.*$/gm, "").replace(/\{\/\*[\s\S]*?\*\/\}/g, "").replace(/<[A-Za-z][^>]*>/g, keepTagTitle).replace(/<\/[A-Za-z][^>]*>/g, "")
2198
2198
  );
2199
2199
  return cleaned.join("").replace(/\n{3,}/g, "\n\n").trim();
2200
2200
  }
2201
+ function keepTagTitle(tag) {
2202
+ const title = /\btitle="([^"]*)"/.exec(tag)?.[1];
2203
+ if (title === void 0 || title === "") {
2204
+ return "";
2205
+ }
2206
+ const href = /\bhref="([^"]*)"/.exec(tag)?.[1];
2207
+ return href === void 0 ? `**${title}**` : `[${title}](${href})`;
2208
+ }
2201
2209
  function summariseApiPage(title, description, body, documents) {
2202
2210
  const opMatch = /operations=\{(\[[\s\S]*?\])\}/.exec(body);
2203
2211
  let ops = [];