@taprootio/site-authoring 0.10.8 → 0.10.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taprootio/site-authoring",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Taproot site authoring CLI: sign in once in the browser, then pull, validate, push, preview, approve, and deploy a site from the terminal",
5
5
  "type": "module",
6
6
  "license": "ISC",
package/src/constants.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const CLI_NAME = "@taprootio/site-authoring";
2
- export const CLI_VERSION = "0.10.8";
2
+ export const CLI_VERSION = "0.10.9";
3
3
  export const CLI_BINARY_NAME = "taproot-site";
4
4
  export const RESULT_SCHEMA_VERSION = 1;
5
5
  export const CONFIG_FILE_NAME = "taproot-site.json";
@@ -76,6 +76,8 @@ export interface RenderProseMirrorOptions {
76
76
  };
77
77
  /** Records visible document-order content after each node is rendered. */
78
78
  onRenderedNode?: (node: ProseMirrorNode, html: string) => void;
79
+ /** Maps an authored heading level (1–4) to the level rendered; defaults to the authored level. */
80
+ headingLevel?: (authored: number) => number;
79
81
  /** Claims the page's one LCP slot before rendering a section photo. */
80
82
  claimSectionBackgroundImage?: () => boolean;
81
83
  }
@@ -363,7 +365,8 @@ function wrapMark(html: string, mark: ProseMirrorMark): string {
363
365
 
364
366
  function renderHeading(node: ProseMirrorNode, options: RenderProseMirrorOptions): string {
365
367
  const rawLevel = numberAttr(node.attrs?.level) ?? 1;
366
- const level = Math.min(4, Math.max(1, Math.trunc(rawLevel)));
368
+ const authored = Math.min(4, Math.max(1, Math.trunc(rawLevel)));
369
+ const level = Math.min(6, Math.max(1, options.headingLevel?.(authored) ?? authored));
367
370
  return renderElement(
368
371
  `h${level}`,
369
372
  withProseMeasure(textBlockAttrs(node.attrs), node.type, options),