@dogsbay/format-dogsbay-md 0.2.0-beta.133 → 0.2.0-beta.135

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/browser.d.ts CHANGED
@@ -22,4 +22,4 @@ export { maskMinjaInCode, unmaskMinjaInCode, maskAllMinjaOpeners, isMinjaProcess
22
22
  export { extractHeadings, slugifyHeadingText, type HeadingInfo } from "./headings.js";
23
23
  export { splitFrontmatter, type Frontmatter } from "./frontmatter.js";
24
24
  export { TemplatePages, TemplatePageError, declaresParams, ATTRIBUTE_BLOCK_OPEN, type TemplatePagesOptions } from "./template-pages.js";
25
- export { dogsbayMdPageFiles, mountCopies, carriedFrontmatter, MEDIA_EXTS, type AssetMount } from "./project.js";
25
+ export { dogsbayMdPageFiles, dogsbayMdPagePath, mountCopies, carriedFrontmatter, MEDIA_EXTS, type AssetMount } from "./project.js";
package/dist/browser.js CHANGED
@@ -22,4 +22,4 @@ export { maskMinjaInCode, unmaskMinjaInCode, maskAllMinjaOpeners, isMinjaProcess
22
22
  export { extractHeadings, slugifyHeadingText } from "./headings.js";
23
23
  export { splitFrontmatter } from "./frontmatter.js";
24
24
  export { TemplatePages, TemplatePageError, declaresParams, ATTRIBUTE_BLOCK_OPEN } from "./template-pages.js";
25
- export { dogsbayMdPageFiles, mountCopies, carriedFrontmatter, MEDIA_EXTS } from "./project.js";
25
+ export { dogsbayMdPageFiles, dogsbayMdPagePath, mountCopies, carriedFrontmatter, MEDIA_EXTS } from "./project.js";
package/dist/escape.js CHANGED
@@ -145,5 +145,7 @@ export function normalizeTrailingWhitespace(content) {
145
145
  if (blankRun < 2)
146
146
  out.push(trimmed);
147
147
  }
148
- return out.join("\n").replace(/\s*$/, "\n");
148
+ // trimEnd removes what `\s*$` matched, in one pass: the regex, tried at every whitespace run,
149
+ // was 1.8 s of pan.dev's 9,203 pages
150
+ return out.join("\n").trimEnd() + "\n";
149
151
  }
package/dist/project.d.ts CHANGED
@@ -27,6 +27,8 @@ export declare const MEDIA_EXTS: Set<string>;
27
27
  */
28
28
  export declare function carriedFrontmatter(fm: Record<string, unknown> | undefined): Record<string, unknown>;
29
29
  /** Each page as `<slug>.md` and the nav as `nav.json`, relative to the content root. */
30
+ /** The file a page is written to, relative to the content root (`dogsbayMdPageFiles`). */
31
+ export declare function dogsbayMdPagePath(page: Pick<ExportPage, "slug">): string;
30
32
  export declare function dogsbayMdPageFiles(pages: ExportPage[], nav: NavItem[]): Map<string, string>;
31
33
  /** An importer's asset directory, as `ImportResult.assetMounts` declares it, relative to the corpus. */
32
34
  export interface AssetMount {
package/dist/project.js CHANGED
@@ -58,10 +58,13 @@ export function carriedFrontmatter(fm) {
58
58
  return out;
59
59
  }
60
60
  /** Each page as `<slug>.md` and the nav as `nav.json`, relative to the content root. */
61
+ /** The file a page is written to, relative to the content root (`dogsbayMdPageFiles`). */
62
+ export function dogsbayMdPagePath(page) {
63
+ return `${page.slug || "index"}.md`;
64
+ }
61
65
  export function dogsbayMdPageFiles(pages, nav) {
62
66
  const files = new Map();
63
67
  for (const page of pages) {
64
- const slug = page.slug || "index";
65
68
  // A template partial keeps its `params:` and the template flag, so the
66
69
  // build treats it as a partial and checks every include against it.
67
70
  const templateFm = page.template ? { template: "jinja", ...(page.templateParams ? { params: page.templateParams } : {}) } : {};
@@ -71,7 +74,7 @@ export function dogsbayMdPageFiles(pages, nav) {
71
74
  ? (page.template ? templateFm : undefined)
72
75
  : { title: page.title, ...carriedFrontmatter(page.frontmatter), ...(page.redirect ? { redirect: page.redirect } : {}), ...templateFm };
73
76
  const md = treeToDogsbayMd(page.tree, frontmatter ? { frontmatter } : undefined);
74
- files.set(`${slug}.md`, md.endsWith("\n") ? md : md + "\n");
77
+ files.set(dogsbayMdPagePath(page), md.endsWith("\n") ? md : md + "\n");
75
78
  }
76
79
  // Nav as nav.json at the content root (the dogsbay-md importer + runtime
77
80
  // loader both prefer nav.json). Fragments never appear here.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/format-dogsbay-md",
3
- "version": "0.2.0-beta.133",
3
+ "version": "0.2.0-beta.135",
4
4
  "description": "Dogsbay Markdown dialect — canonical format for TreeNode[] with directives, YAML bodies, and intelligent fallbacks",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,10 +40,10 @@
40
40
  "markdown-it-footnote": "^4.0.0",
41
41
  "markdown-it-front-matter": "^0.2.4",
42
42
  "pele": "1.6.0",
43
- "@dogsbay/corpus": "0.2.0-beta.133",
44
- "@dogsbay/serialize-core": "0.2.0-beta.133",
45
- "@dogsbay/minja": "0.2.0-beta.133",
46
- "@dogsbay/types": "0.2.0-beta.133"
43
+ "@dogsbay/minja": "0.2.0-beta.135",
44
+ "@dogsbay/corpus": "0.2.0-beta.135",
45
+ "@dogsbay/serialize-core": "0.2.0-beta.135",
46
+ "@dogsbay/types": "0.2.0-beta.135"
47
47
  },
48
48
  "license": "MIT",
49
49
  "repository": {