@scrider/formatter 1.4.1 → 1.4.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/index.d.cts CHANGED
@@ -1292,16 +1292,44 @@ declare function validateDelta(delta: Delta, registry: Registry): boolean;
1292
1292
  */
1293
1293
  declare function cloneDelta(delta: Delta): Delta;
1294
1294
 
1295
+ /** Per-paragraph line spacing stored on `\n` (Word paste, Settings Apply, toolbar). */
1296
+ declare const SCRIDER_LINE_HEIGHT_KEY = "scrider-line-height";
1297
+ /** Space after plain paragraph (`margin-bottom`) on `\n` (Settings Apply). */
1298
+ declare const SCRIDER_MARGIN_AFTER_KEY = "scrider-margin-after";
1299
+ /** Block tags that receive line spacing (not headings). */
1300
+ declare const LINE_HEIGHT_BLOCK_TAGS: Set<string>;
1301
+ /** Block tags that receive paragraph spacing after (plain `<p>` only). */
1302
+ declare const PARAGRAPH_SPACING_BLOCK_TAGS: Set<string>;
1295
1303
  /**
1304
+ * Parse a line-height multiplier from Delta / inline CSS values
1305
+ * (`1.5`, `2`, `150%`).
1306
+ */
1307
+ declare function parseScriderLineHeightMultiplier(value: string): number | undefined;
1308
+ /**
1309
+ * Line-height for a block tag: `scrider-line-height` on the line → documentPresentation → none.
1310
+ */
1311
+ declare function blockLineHeightStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
1312
+ /**
1313
+ * Parse `margin-bottom` in em from Delta / inline CSS (`0.5em`, `0.5`).
1314
+ */
1315
+ declare function parseScriderMarginAfterEm(value: string): number | undefined;
1316
+ /**
1317
+ * Paragraph spacing after: `scrider-margin-after` on the line → documentPresentation → none.
1318
+ */
1319
+ declare function blockMarginAfterStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
1296
1320
 
1321
+ /**
1297
1322
  * Document-level HTML presentation for deltaToHtml (clipboard, export).
1298
-
1299
- * Not stored in Delta mirrors editor Settings (line spacing, indents).
1300
-
1323
+ * Mirrors editor Settings when block attrs are absent.
1324
+ * Per-block line spacing: {@link blockLineHeightStyleParts} (`scrider-line-height` on `\n`).
1325
+ * Per-block paragraph spacing: {@link blockMarginAfterStyleParts} (`scrider-margin-after` on `\n`).
1301
1326
  */
1327
+
1302
1328
  interface DocumentPresentation {
1303
1329
  /** Line spacing multiplier, e.g. 1.5 */
1304
1330
  lineSpacing?: number;
1331
+ /** Space after plain paragraphs in em, e.g. 0.5 */
1332
+ paragraphSpacingAfterEm?: number;
1305
1333
  /** First-line indent in cm on `<p>` only (lists: use listBlockIndentCm). */
1306
1334
  textIndentCm?: number;
1307
1335
  /** Extra left padding on top-level `<ul>`/`<ol>` — shifts marker + text as a block. */
@@ -1309,11 +1337,17 @@ interface DocumentPresentation {
1309
1337
  }
1310
1338
  interface ResolvedDocumentPresentation {
1311
1339
  lineSpacing: number | undefined;
1340
+ paragraphSpacingAfterEm: number | undefined;
1312
1341
  textIndentCm: number | undefined;
1313
1342
  listBlockIndentCm: number | undefined;
1314
1343
  }
1315
1344
  declare function resolveDocumentPresentation(presentation?: DocumentPresentation): ResolvedDocumentPresentation | undefined;
1345
+ /** Document-level styles only (line-height merged via {@link blockLineHeightStyleParts}). */
1316
1346
  declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
1347
+ /**
1348
+ * All block presentation styles for deltaToHtml: Delta attrs, then document defaults.
1349
+ */
1350
+ declare function blockPresentationStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
1317
1351
 
1318
1352
  /**
1319
1353
  * Simple Table HTML presentation options for deltaToHtml (clipboard, export).
@@ -1891,4 +1925,4 @@ declare function isTableNewlineOp(op: Op | undefined): boolean;
1891
1925
  */
1892
1926
  declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
1893
1927
 
1894
- export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatScope, type HtmlToDeltaOptions, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, Registry, type ResolvedDocumentPresentation, type ResolvedTablePresentation, type SanitizeOptions, type TableBlockData, type TableCellAlign, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, preloadRemark, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
1928
+ export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatScope, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, type SanitizeOptions, type TableBlockData, type TableCellAlign, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockPresentationStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, preloadRemark, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
package/dist/index.d.ts CHANGED
@@ -1292,16 +1292,44 @@ declare function validateDelta(delta: Delta, registry: Registry): boolean;
1292
1292
  */
1293
1293
  declare function cloneDelta(delta: Delta): Delta;
1294
1294
 
1295
+ /** Per-paragraph line spacing stored on `\n` (Word paste, Settings Apply, toolbar). */
1296
+ declare const SCRIDER_LINE_HEIGHT_KEY = "scrider-line-height";
1297
+ /** Space after plain paragraph (`margin-bottom`) on `\n` (Settings Apply). */
1298
+ declare const SCRIDER_MARGIN_AFTER_KEY = "scrider-margin-after";
1299
+ /** Block tags that receive line spacing (not headings). */
1300
+ declare const LINE_HEIGHT_BLOCK_TAGS: Set<string>;
1301
+ /** Block tags that receive paragraph spacing after (plain `<p>` only). */
1302
+ declare const PARAGRAPH_SPACING_BLOCK_TAGS: Set<string>;
1295
1303
  /**
1304
+ * Parse a line-height multiplier from Delta / inline CSS values
1305
+ * (`1.5`, `2`, `150%`).
1306
+ */
1307
+ declare function parseScriderLineHeightMultiplier(value: string): number | undefined;
1308
+ /**
1309
+ * Line-height for a block tag: `scrider-line-height` on the line → documentPresentation → none.
1310
+ */
1311
+ declare function blockLineHeightStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
1312
+ /**
1313
+ * Parse `margin-bottom` in em from Delta / inline CSS (`0.5em`, `0.5`).
1314
+ */
1315
+ declare function parseScriderMarginAfterEm(value: string): number | undefined;
1316
+ /**
1317
+ * Paragraph spacing after: `scrider-margin-after` on the line → documentPresentation → none.
1318
+ */
1319
+ declare function blockMarginAfterStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
1296
1320
 
1321
+ /**
1297
1322
  * Document-level HTML presentation for deltaToHtml (clipboard, export).
1298
-
1299
- * Not stored in Delta mirrors editor Settings (line spacing, indents).
1300
-
1323
+ * Mirrors editor Settings when block attrs are absent.
1324
+ * Per-block line spacing: {@link blockLineHeightStyleParts} (`scrider-line-height` on `\n`).
1325
+ * Per-block paragraph spacing: {@link blockMarginAfterStyleParts} (`scrider-margin-after` on `\n`).
1301
1326
  */
1327
+
1302
1328
  interface DocumentPresentation {
1303
1329
  /** Line spacing multiplier, e.g. 1.5 */
1304
1330
  lineSpacing?: number;
1331
+ /** Space after plain paragraphs in em, e.g. 0.5 */
1332
+ paragraphSpacingAfterEm?: number;
1305
1333
  /** First-line indent in cm on `<p>` only (lists: use listBlockIndentCm). */
1306
1334
  textIndentCm?: number;
1307
1335
  /** Extra left padding on top-level `<ul>`/`<ol>` — shifts marker + text as a block. */
@@ -1309,11 +1337,17 @@ interface DocumentPresentation {
1309
1337
  }
1310
1338
  interface ResolvedDocumentPresentation {
1311
1339
  lineSpacing: number | undefined;
1340
+ paragraphSpacingAfterEm: number | undefined;
1312
1341
  textIndentCm: number | undefined;
1313
1342
  listBlockIndentCm: number | undefined;
1314
1343
  }
1315
1344
  declare function resolveDocumentPresentation(presentation?: DocumentPresentation): ResolvedDocumentPresentation | undefined;
1345
+ /** Document-level styles only (line-height merged via {@link blockLineHeightStyleParts}). */
1316
1346
  declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
1347
+ /**
1348
+ * All block presentation styles for deltaToHtml: Delta attrs, then document defaults.
1349
+ */
1350
+ declare function blockPresentationStyleParts(tag: string, blockAttributes: AttributeMap | undefined, resolved: ResolvedDocumentPresentation | undefined): string[];
1317
1351
 
1318
1352
  /**
1319
1353
  * Simple Table HTML presentation options for deltaToHtml (clipboard, export).
@@ -1891,4 +1925,4 @@ declare function isTableNewlineOp(op: Op | undefined): boolean;
1891
1925
  */
1892
1926
  declare function extractTableRegion(ops: readonly Op[], hintOpIdx: number): TableRegion | null;
1893
1927
 
1894
- export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatScope, type HtmlToDeltaOptions, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, Registry, type ResolvedDocumentPresentation, type ResolvedTablePresentation, type SanitizeOptions, type TableBlockData, type TableCellAlign, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, preloadRemark, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
1928
+ export { ALERT_TYPES, type AlertBlockData, type AlertType, type AlignType, BOX_FLOAT_VALUES, BOX_OVERFLOW_VALUES, type BlockContext, type BlockHandler, BlockHandlerRegistry, type BlockRenderOptions, type BoxBlockData, type BoxFloat, type BoxOpAttributes, type BoxOverflow, BrowserDOMAdapter, type CellAlign, type CellData, type ColumnsBlockData, type DOMAdapter, type DOMDocument, type DOMDocumentFragment, type DOMElement, type DOMNode, type DOMNodeList, type DeltaToHtmlOptions, type DeltaToMarkdownOptions, type DocumentPresentation, type FootnotesBlockData, type Format, type FormatDefinition, type FormatMatchResult, type FormatScope, type HtmlToDeltaOptions, LINE_HEIGHT_BLOCK_TAGS, type ListType, type MarkdownToDeltaOptions, NODE_TYPE, NodeDOMAdapter, PARAGRAPH_SPACING_BLOCK_TAGS, Registry, type ResolvedDocumentPresentation, type ResolvedTablePresentation, SCRIDER_LINE_HEIGHT_KEY, SCRIDER_MARGIN_AFTER_KEY, type SanitizeOptions, type TableBlockData, type TableCellAlign, type TableColAlignType, type TablePresentation, type TableRegion, alertBlockHandler, alignFormat, backgroundFormat, blockFormat, blockLineHeightStyleParts, blockMarginAfterStyleParts, blockPresentationStyleParts, blockquoteFormat, boldFormat, boxBlockHandler, browserAdapter, cloneDelta, codeBlockFormat, codeFormat, colorFormat, columnsBlockHandler, createDefaultBlockHandlers, createDefaultRegistry, defaultBlockFormats, defaultEmbedFormats, defaultFormats, defaultInlineFormats, deltaToHtml, deltaToMarkdown, dividerFormat, documentPresentationStyleParts, escapeHtml, extractBoxOpAttributes, extractTableRegion, fontFormat, footnoteRefFormat, footnotesBlockHandler, formulaFormat, getAdapter, getNamedColors, headerFormat, headerIdFormat, htmlToDelta, imageFormat, indentFormat, isAdapterAvailable, isElement, isRemarkAvailable, isTableNewlineOp, isTextNode, isValidColor, isValidHexColor, isZebraBodyRow, italicFormat, kbdFormat, linkFormat, listFormat, markFormat, markdownToDelta, markdownToDeltaSync, nodeAdapter, normalizeDelta, parseScriderLineHeightMultiplier, parseScriderMarginAfterEm, preloadRemark, resolveDocumentPresentation, resolveTablePresentation, sanitizeDelta, sizeFormat, slugify, slugifyWithDedup, softBreakFormat, strikeFormat, subscriptFormat, superscriptFormat, tableBlockHandler, tableColAlignFormat, tableColFormat, tableHeaderFormat, tableRowFormat, toHexColor, underlineFormat, unescapeHtml, validateDelta, videoFormat };
package/dist/index.js CHANGED
@@ -2493,39 +2493,100 @@ function slugifyWithDedup(text, usedSlugs) {
2493
2493
  return `${base}-${count}`;
2494
2494
  }
2495
2495
 
2496
+ // src/conversion/html/block-presentation.ts
2497
+ var SCRIDER_LINE_HEIGHT_KEY = "scrider-line-height";
2498
+ var SCRIDER_MARGIN_AFTER_KEY = "scrider-margin-after";
2499
+ var LINE_HEIGHT_BLOCK_TAGS = /* @__PURE__ */ new Set(["p", "li", "blockquote"]);
2500
+ var PARAGRAPH_SPACING_BLOCK_TAGS = /* @__PURE__ */ new Set(["p"]);
2501
+ function parseScriderLineHeightMultiplier(value) {
2502
+ const trimmed = value.trim();
2503
+ if (!trimmed) return void 0;
2504
+ if (trimmed.endsWith("%")) {
2505
+ const pct = Number.parseFloat(trimmed.slice(0, -1));
2506
+ if (Number.isFinite(pct) && pct > 0) return pct / 100;
2507
+ return void 0;
2508
+ }
2509
+ const n = Number.parseFloat(trimmed);
2510
+ if (Number.isFinite(n) && n > 0) return n;
2511
+ return void 0;
2512
+ }
2513
+ function lineHeightStyleParts(multiplier) {
2514
+ const pct = Math.round(multiplier * 100);
2515
+ return [`line-height:${multiplier}`, `mso-line-height-alt:${pct}%`];
2516
+ }
2517
+ function blockLineHeightStyleParts(tag, blockAttributes, resolved) {
2518
+ if (!LINE_HEIGHT_BLOCK_TAGS.has(tag)) return [];
2519
+ const raw = blockAttributes?.[SCRIDER_LINE_HEIGHT_KEY];
2520
+ if (typeof raw === "string") {
2521
+ const fromBlock = parseScriderLineHeightMultiplier(raw);
2522
+ if (fromBlock !== void 0) return lineHeightStyleParts(fromBlock);
2523
+ }
2524
+ if (resolved?.lineSpacing !== void 0) {
2525
+ return lineHeightStyleParts(resolved.lineSpacing);
2526
+ }
2527
+ return [];
2528
+ }
2529
+ function parseScriderMarginAfterEm(value) {
2530
+ const trimmed = value.trim();
2531
+ if (!trimmed) return void 0;
2532
+ const emMatch = trimmed.match(/^(-?\d+(?:\.\d+)?)\s*em$/i);
2533
+ if (emMatch) {
2534
+ const n2 = Number.parseFloat(emMatch[1]);
2535
+ if (Number.isFinite(n2) && n2 >= 0) return n2;
2536
+ return void 0;
2537
+ }
2538
+ const n = Number.parseFloat(trimmed);
2539
+ if (Number.isFinite(n) && n >= 0) return n;
2540
+ return void 0;
2541
+ }
2542
+ function marginAfterStyleParts(em) {
2543
+ return [`margin-top:0`, `margin-bottom:${em}em`];
2544
+ }
2545
+ function blockMarginAfterStyleParts(tag, blockAttributes, resolved) {
2546
+ if (!PARAGRAPH_SPACING_BLOCK_TAGS.has(tag)) return [];
2547
+ const raw = blockAttributes?.[SCRIDER_MARGIN_AFTER_KEY];
2548
+ if (typeof raw === "string") {
2549
+ const fromBlock = parseScriderMarginAfterEm(raw);
2550
+ if (fromBlock !== void 0) return marginAfterStyleParts(fromBlock);
2551
+ }
2552
+ if (resolved?.paragraphSpacingAfterEm !== void 0) {
2553
+ return marginAfterStyleParts(resolved.paragraphSpacingAfterEm);
2554
+ }
2555
+ return [];
2556
+ }
2557
+
2496
2558
  // src/conversion/html/document-presentation.ts
2497
2559
  function resolveDocumentPresentation(presentation) {
2498
2560
  if (!presentation) return void 0;
2499
2561
  const lineSpacing = typeof presentation.lineSpacing === "number" && presentation.lineSpacing > 0 ? presentation.lineSpacing : void 0;
2500
2562
  const textIndentCm = typeof presentation.textIndentCm === "number" && presentation.textIndentCm > 0 ? presentation.textIndentCm : void 0;
2501
2563
  const listBlockIndentCm = typeof presentation.listBlockIndentCm === "number" && presentation.listBlockIndentCm > 0 ? presentation.listBlockIndentCm : void 0;
2502
- if (lineSpacing === void 0 && textIndentCm === void 0 && listBlockIndentCm === void 0) {
2564
+ const paragraphSpacingAfterEm = typeof presentation.paragraphSpacingAfterEm === "number" && Number.isFinite(presentation.paragraphSpacingAfterEm) && presentation.paragraphSpacingAfterEm >= 0 ? presentation.paragraphSpacingAfterEm : void 0;
2565
+ if (lineSpacing === void 0 && paragraphSpacingAfterEm === void 0 && textIndentCm === void 0 && listBlockIndentCm === void 0) {
2503
2566
  return void 0;
2504
2567
  }
2505
- return { lineSpacing, textIndentCm, listBlockIndentCm };
2568
+ return { lineSpacing, paragraphSpacingAfterEm, textIndentCm, listBlockIndentCm };
2506
2569
  }
2507
- var LINE_HEIGHT_TAGS = /* @__PURE__ */ new Set(["p", "li", "blockquote"]);
2508
2570
  var TEXT_INDENT_TAGS = /* @__PURE__ */ new Set(["p"]);
2509
2571
  function documentPresentationListWrapperStyleParts(resolved) {
2510
2572
  if (!resolved?.listBlockIndentCm) return [];
2511
- return [
2512
- `padding-left:1.25em`,
2513
- `margin-left:${resolved.listBlockIndentCm}cm`
2514
- ];
2573
+ return [`padding-left:1.25em`, `margin-left:${resolved.listBlockIndentCm}cm`];
2515
2574
  }
2516
2575
  function documentPresentationStyleParts(tag, resolved) {
2517
2576
  if (!resolved) return [];
2518
2577
  const parts = [];
2519
- if (resolved.lineSpacing !== void 0 && LINE_HEIGHT_TAGS.has(tag)) {
2520
- const pct = Math.round(resolved.lineSpacing * 100);
2521
- parts.push(`line-height:${resolved.lineSpacing}`);
2522
- parts.push(`mso-line-height-alt:${pct}%`);
2523
- }
2524
2578
  if (resolved.textIndentCm !== void 0 && TEXT_INDENT_TAGS.has(tag)) {
2525
2579
  parts.push(`text-indent:${resolved.textIndentCm}cm`);
2526
2580
  }
2527
2581
  return parts;
2528
2582
  }
2583
+ function blockPresentationStyleParts(tag, blockAttributes, resolved) {
2584
+ return [
2585
+ ...blockLineHeightStyleParts(tag, blockAttributes, resolved),
2586
+ ...blockMarginAfterStyleParts(tag, blockAttributes, resolved),
2587
+ ...documentPresentationStyleParts(tag, resolved)
2588
+ ];
2589
+ }
2529
2590
  function joinStyleParts(parts) {
2530
2591
  return parts.length > 0 ? ` style="${parts.join("; ")}"` : "";
2531
2592
  }
@@ -2672,6 +2733,7 @@ function deltaToHtml(delta, options = {}) {
2672
2733
  html += renderListItem(
2673
2734
  content,
2674
2735
  listItemAttrs,
2736
+ line.attributes,
2675
2737
  pretty,
2676
2738
  indentLevel,
2677
2739
  hierarchicalNumber,
@@ -2991,17 +3053,14 @@ function getListItemAttributes(attributes) {
2991
3053
  }
2992
3054
  return "";
2993
3055
  }
2994
- function renderListItem(content, attrs, pretty, indentLevel, hierarchicalNumber, resolvedDocumentPresentation) {
3056
+ function renderListItem(content, attrs, blockAttributes, pretty, indentLevel, hierarchicalNumber, resolvedDocumentPresentation) {
2995
3057
  const indent = pretty ? getIndent(indentLevel) : "";
2996
3058
  const innerContent = content || "<br>";
2997
3059
  let fullAttrs = attrs;
2998
3060
  if (hierarchicalNumber) {
2999
3061
  fullAttrs += ` data-number="${hierarchicalNumber}"`;
3000
3062
  }
3001
- const styleAttr = joinStyleParts(
3002
- documentPresentationStyleParts("li", resolvedDocumentPresentation)
3003
- );
3004
- fullAttrs += styleAttr;
3063
+ fullAttrs += getBlockStyleAttribute("li", blockAttributes, resolvedDocumentPresentation);
3005
3064
  const html = `${indent}<li${fullAttrs}>${innerContent}</li>`;
3006
3065
  return pretty ? html + "\n" : html;
3007
3066
  }
@@ -3013,7 +3072,11 @@ function renderBlock(content, tag, attributes, pretty, id, resolvedDocumentPrese
3013
3072
  return pretty ? html + "\n" : html;
3014
3073
  }
3015
3074
  function getBlockStyleAttribute(tag, attributes, resolvedDocumentPresentation) {
3016
- const styles = documentPresentationStyleParts(tag, resolvedDocumentPresentation);
3075
+ const styles = blockPresentationStyleParts(
3076
+ tag,
3077
+ attributes,
3078
+ resolvedDocumentPresentation
3079
+ );
3017
3080
  if (attributes) {
3018
3081
  const alignVal = attributes.align;
3019
3082
  if (alignVal && typeof alignVal === "string" && alignVal !== "left") {
@@ -5152,13 +5215,20 @@ export {
5152
5215
  BOX_OVERFLOW_VALUES,
5153
5216
  BlockHandlerRegistry,
5154
5217
  BrowserDOMAdapter,
5218
+ LINE_HEIGHT_BLOCK_TAGS,
5155
5219
  NODE_TYPE,
5156
5220
  NodeDOMAdapter,
5221
+ PARAGRAPH_SPACING_BLOCK_TAGS,
5157
5222
  Registry,
5223
+ SCRIDER_LINE_HEIGHT_KEY,
5224
+ SCRIDER_MARGIN_AFTER_KEY,
5158
5225
  alertBlockHandler,
5159
5226
  alignFormat,
5160
5227
  backgroundFormat,
5161
5228
  blockFormat,
5229
+ blockLineHeightStyleParts,
5230
+ blockMarginAfterStyleParts,
5231
+ blockPresentationStyleParts,
5162
5232
  blockquoteFormat,
5163
5233
  boldFormat,
5164
5234
  boxBlockHandler,
@@ -5209,6 +5279,8 @@ export {
5209
5279
  markdownToDeltaSync,
5210
5280
  nodeAdapter,
5211
5281
  normalizeDelta,
5282
+ parseScriderLineHeightMultiplier,
5283
+ parseScriderMarginAfterEm,
5212
5284
  preloadRemark,
5213
5285
  resolveDocumentPresentation,
5214
5286
  resolveTablePresentation,