epub-codec 1.0.5 → 1.2.0

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 (50) hide show
  1. package/README.md +3 -1
  2. package/dist/codec.d.cts +2 -2
  3. package/dist/codec.d.ts +2 -2
  4. package/dist/{diagnostics-tvGwPH46.d.cts → diagnostics-C0CRdoda.d.cts} +8 -0
  5. package/dist/{diagnostics-tvGwPH46.d.ts → diagnostics-C0CRdoda.d.ts} +8 -0
  6. package/dist/diagnostics.cjs +8 -0
  7. package/dist/diagnostics.d.cts +1 -1
  8. package/dist/diagnostics.d.ts +1 -1
  9. package/dist/diagnostics.js +8 -0
  10. package/dist/index.cjs +8 -3
  11. package/dist/index.d.cts +6 -6
  12. package/dist/index.d.ts +6 -6
  13. package/dist/index.js +5 -5
  14. package/dist/opf/metadata.cjs +4 -5
  15. package/dist/opf/metadata.d.cts +1 -1
  16. package/dist/opf/metadata.d.ts +1 -1
  17. package/dist/opf/metadata.js +5 -6
  18. package/dist/opf/parse.d.cts +1 -1
  19. package/dist/opf/parse.d.ts +1 -1
  20. package/dist/read.d.cts +1 -1
  21. package/dist/read.d.ts +1 -1
  22. package/dist/write.cjs +1 -1
  23. package/dist/write.d.cts +1 -1
  24. package/dist/write.d.ts +1 -1
  25. package/dist/write.js +1 -1
  26. package/dist/xhtml/context.cjs +18 -0
  27. package/dist/xhtml/context.d.cts +4 -2
  28. package/dist/xhtml/context.d.ts +4 -2
  29. package/dist/xhtml/context.js +16 -0
  30. package/dist/xhtml/inline.cjs +9 -3
  31. package/dist/xhtml/inline.js +9 -3
  32. package/dist/xhtml/read.cjs +330 -47
  33. package/dist/xhtml/read.js +331 -48
  34. package/dist/xhtml/write.cjs +72 -23
  35. package/dist/xhtml/write.d.cts +1 -1
  36. package/dist/xhtml/write.d.ts +1 -1
  37. package/dist/xhtml/write.js +72 -23
  38. package/dist/xml/entities.cjs +4 -0
  39. package/dist/xml/entities.d.cts +3 -1
  40. package/dist/xml/entities.d.ts +3 -1
  41. package/dist/xml/entities.js +4 -1
  42. package/dist/xml/node.cjs +4 -0
  43. package/dist/xml/node.d.cts +2 -1
  44. package/dist/xml/node.d.ts +2 -1
  45. package/dist/xml/node.js +4 -1
  46. package/dist/xml/query.cjs +9 -0
  47. package/dist/xml/query.d.cts +2 -1
  48. package/dist/xml/query.d.ts +2 -1
  49. package/dist/xml/query.js +9 -1
  50. package/package.json +8 -2
package/README.md CHANGED
@@ -132,7 +132,9 @@ Every construct this package's XHTML mapping cannot represent losslessly is a do
132
132
  - **`epub/style-residue`** — a document's own `<head>` style declarations (`<link rel="stylesheet">`, `<style>`) are quarantined verbatim as `SourceResidue` on the owning `ContentSection`, never interpreted: CSS is residue, not content. `writeEpubContent` re-emits it into the written `<head>` on a same-format write (this family's standard restorable-fidelity re-emission contract).
133
133
  - **An empty or whitespace-only paragraph (`<p></p>`, `<p> </p>`, or bare whitespace text between two block-level siblings — the common case in any pretty-printed real EPUB) is dropped entirely on read**, matching the same "anonymous block box" rule a browser's own HTML block-formatting context already applies to inter-block whitespace, rather than becoming a bogus empty `ContentParagraph`.
134
134
  - **List marker type (bullet vs. ordered, and an `<ol>`'s own non-default `start`) is packed into the opaque `numId`** (`epub{N}:{bullet|ordered}[@{start}]`, `src/xhtml/list-id.ts`), since `ContentListMembership` carries no field of its own for it — the identical mechanism `markdown-codec`'s own `src/shared/list-id.ts` uses for its GFM bullet/ordered distinction, hand-mirrored rather than shared. A numId outside this grammar (odf.js's bare `"list1"`, markdown-codec's own `"md1:bullet"`) is read back as an ordinary bullet list with no declared start.
135
- - **A container's own direct-child `<img>`** (some producers/editors wrap every floating image in a paragraph tag rather than a `<figure>`) is split at the image by `readContainerChildren`: the phrasing content before and after becomes its own paragraph (dropped entirely when empty), the image its own block, in source order. That split fires for every container this package reads transparently through `readContainerChildren` — `<body>` itself, `<p>`, `<li>`, `<blockquote>`, `<figure>`, `<div>`, `<section>`, `<article>`, `<aside>`, and `<nav>` — never only a named handful of them; an `<img>` reached anywhere else — nested inside a `<span>`/`<a>` at any depth, or a _direct_ child of a heading, a `<figcaption>`, a `<dt>`/`<dd>`, or a table cell, none of which route through `readContainerChildren` at all — is instead reached by `src/xhtml/inline.ts`'s own run-building recursion, which by that point has committed to producing a flat run sequence with no block list left to insert a sibling image block into, and degrades to its alt text (or nothing, when it carries none) with an `epub/image-inline-unsupported` diagnostic rather than silently vanishing. That guarantee covers those inline-recursion paths specifically, not every remaining case: an `<img>` inside a `<pre>`/`<code>` block is lost outright, since `readPre` extracts only text content and never reaches `inline.ts` at all; one inside a `<table>`'s own `<caption>` is lost the same way, since `readTable` only descends into `tr`/`thead`/`tbody`/`tfoot` and drops any other child; a `<dl>` wrapping its `<dt>`/`<dd>` pairs in a `<div>` (legal HTML5, used by producers that want a per-entry styling hook) loses the whole wrapped group, since `readDefinitionList` only recognises a `dt`/`dd` that is a direct child of the `<dl>`; and a `<ul>`/`<ol>` nested directly inside another list rather than inside an `<li>` (not valid HTML5, but a shape real-world converters do emit) loses the entire nested list and its content, since `readList` only recognises an `<li>` childfour genuinely silent gaps, tracked as [ExaDev/documents.js#994](https://github.com/ExaDev/documents.js/issues/994) rather than fixed here.
135
+ - **A container's own direct-child `<img>`** (some producers/editors wrap every floating image in a paragraph tag rather than a `<figure>`) is split at the image by `readContainerChildren`: the phrasing content before and after becomes its own paragraph (dropped entirely when empty), the image its own block, in source order. That split fires for every container this package reads transparently through `readContainerChildren` — `<body>` itself, `<p>`, `<li>`, `<blockquote>`, `<figure>`, `<div>`, `<section>`, `<article>`, `<aside>`, and `<nav>` — never only a named handful of them; an `<img>` reached anywhere else — nested inside a `<span>`/`<a>` at any depth, or a _direct_ child of a heading, a `<figcaption>`, a `<dt>`/`<dd>`, or a table cell, none of which route through `readContainerChildren` at all — is instead reached by `src/xhtml/inline.ts`'s own run-building recursion, which by that point has committed to producing a flat run sequence with no block list left to insert a sibling image block into, and degrades to its alt text (or nothing, when it carries none) with an `epub/image-inline-unsupported` diagnostic rather than silently vanishing. [ExaDev/documents.js#994](https://github.com/ExaDev/documents.js/issues/994) closed the four remaining silent gaps this guarantee did not originally cover: a non-empty `<caption>`, a legal direct child of `<table>`, is now read as an ordinary paragraph immediately before the table (`epub/table-caption-unsupported`, since `ContentTable` has no field of its own for a caption's distinct tag; any `<img>` the caption itself carries degrades to alt text exactly like a `<figcaption>`'s own, and any run-level construct the caption's own inline content carries — a footnote reference, most commonly rides that paragraph's own `constructs` field exactly like any other paragraph's), while an empty or whitespace-only `<caption>` is dropped entirely instead, with no diagnostic, matching this package's own empty-paragraph-drop rule documented above; a `<dl>` wrapping one or more `dt`/`dd` pairs in a `<div>` (legal HTML5, used for a per-entry styling hook) is now recognised by recursing into the `<div>`, with no diagnostic at all, since the wrapper carries no properties of its own to lose (identical to every other `<div>` this package already reads transparently); and any content — a nested `<ul>`/`<ol>`, a bare `<img>`, stray text — sitting directly inside a `<ul>`/`<ol>` rather than inside an `<li>` (not valid HTML5, but a shape real-world converters do emit) is now recovered via `epub/list-content-outside-item`, through the same `readContainerChildren` dispatch an `<li>`'s real children already use: content sitting between or after real `<li>` siblings attaches to the preceding item's own nesting — a stray list shares its numId and increments its level, exactly as if it had been nested correctly — while content sitting before the very first `<li>` has no preceding item to attach to and is instead recovered inheriting whatever list membership its own enclosing context already carries (none, unless the `<ul>`/`<ol>` it sits directly inside is itself nested inside another list's `<li>`), landing in the read result immediately before the list's own real items matching a browser's rendering order for this shape, though not necessarily its nesting depth when the enclosing list is itself nested. One part of the original finding remains a genuine, permanent structural limit rather than a recovered gap: an `<img>` inside a `<pre>`/`<code>` block still cannot become a real `ContentImageBlock` — this package always reads a `<pre>` as a single text-content paragraph, so there is no block list to insert an image block into, the same constraint `epub/image-inline-unsupported` already names elsewhere (the HTML Standard's own content model for `<pre>` is phrasing content, not plain text, which is exactly why `<a>`/`<code>`/`<span>`/`<img>`/`<br>` are legal, real markup inside one and this package's `readPreRuns`/`readPreText` have to handle each explicitly) but it no longer vanishes silently either; its alt text (or nothing, when it carries none) is spliced into the extracted text in its place, with an `epub/image-pre-unsupported` diagnostic firing unconditionally — every image inside a `<pre>`, not only one with no alt text.
136
+ - **A run-level construct extent (most commonly a footnote reference) carried by inline content built directly into a paragraph is preserved on that paragraph's own `constructs` field wherever such a paragraph is built** — a heading, a table caption, a table cell, a `<dt>`/`<dd>`, and a `<figcaption>` all share `constructsField`, the one helper `src/xhtml/read.ts` funnels every such paragraph through, so a fix applied to one of these shapes cannot silently miss the others. A `<pre>`/`<code>` block's own paragraph shares it too, and round-trips it in both directions, despite never routing through `buildInlineRuns` (a `<pre>`'s content model needs its text preserved verbatim, which `buildInlineRuns`'s own whitespace normalisation would break): on read, `readPreRuns`, a dedicated run-splitting walk reached only once a cheap subtree pre-check confirms the `<pre>` actually carries a recognised footnote reference somewhere inside it, brackets that reference's own text as its own run range exactly like `src/xhtml/inline.ts`'s `appendAnchor` does, rebasing any nested call's own construct indices onto the outer run sequence at the point of the merge; the common case (no footnote reference anywhere in the block) still takes the cheap, single-run `readPreText` path unchanged. Because a construct nested inside a `<pre>` can split its content into more than one run with no bearing on whether the block is itself preformatted, `readPre` also stamps every paragraph it produces with `document-schema.js`'s own `ContentParagraph.preformatted` flag, unconditionally and regardless of run count — the one signal the writer can trust, since inferring "this was a `<pre>`" from run shape (a lone monospace run, say) silently misclassifies a multi-run one as an ordinary paragraph the moment it carries a construct. On write, `isPreBlockParagraph` checks `preformatted` first (falling back to `codeLanguage` or the legacy single-monospace-run-with-a-newline heuristic for a foreign producer's document that sets neither), and a recognised `<pre>` paragraph's own runs and constructs are written through `writePreRunsToNodes` — the `<pre>` twin of the ordinary paragraph writer, sharing its extent-finding walk but writing a run's embedded newline as a literal `"\n"` character rather than splitting it into a `<br/>` the way the ordinary path does; `readPreRuns`/`readPreText` map a `<br>` read back from a `<pre>` straight to the same literal `"\n"`, so either spelling round-trips to identical text. A stray element sitting where only a narrower set of tags is expected is likewise recovered rather than dropped, following the same `readContainerChildren`-plus-diagnostic pattern `epub/list-content-outside-item` already established: a `<dl>` (or one of its `<div>` wrappers) carrying anything other than `dt`/`dd`/`<div>` — a stray `<p>`, stray text, a stray `<img>`, or a non-conformant wrapper like `<section>` used in `<div>`'s own place — is recovered via `epub/definition-list-content-outside-entry` (a non-conformant wrapper's own `dt`/`dd` children lose their distinct term/definition treatment once routed this way, degrading to plain concatenated text — a real fidelity cost, but a text-preserving one). The same treatment applies to a `<table>`: content sitting outside any row, caption, or `<colgroup>` — whether directly inside the `<table>` itself, inside one of its `<thead>`/`<tbody>`/`<tfoot>` row groups (which admit only `tr` and script-supporting children per the HTML Standard), or inside a `<colgroup>` itself (which admits only `<col>` and `<template>` children per the HTML Standard — narrower than the script-supporting category, since a `<colgroup>` does not admit a bare `<script>`) — is recovered immediately before the table via `epub/table-content-unrecognized`; a `<tr>` carrying content outside any `<td>`/`<th>` is recovered as its own cell in the row's own column sequence via `epub/table-row-content-outside-cell`; and a `<table>` carrying more than one `<caption>` (HTML5 permits at most one) has every caption beyond the first read as its own paragraph too, via `epub/table-duplicate-caption`, rather than `findChildElement`'s own first-match-only resolution silently discarding it as it previously did. `<script>`, `<template>`, `<style>`, and `<noscript>` appearing anywhere in `<body>` content are all now skipped by one shared guard (`isInertElement`, `src/xhtml/context.ts`) rather than leaking their own raw content as document prose — none of the four were inert outside `<head>`-level residue quarantine before this fix. `<script>`'s raw JS and `<template>`'s inert DOM subtree are never real content regardless of where they are found, and a body-level `<style>` is CSS, exactly like the `<head>`-level style residue this package already quarantines rather than interprets — none of the three fire a diagnostic, since none of them ever carry anything document-schema.js's vocabulary could represent. `<noscript>` is treated the same conservative way for a different reason: its own children ARE ordinary markup a scripting-disabled reading system would genuinely render, but this package cannot tell that case apart from a producer's own "please enable JavaScript" placeholder from the markup alone — so, unlike the other three, dropping a `<noscript>`'s subtree fires its own `epub/noscript-content-skipped` diagnostic (`reportInertElementSkip`, `src/xhtml/context.ts`) at every site that discards one, naming the potential loss rather than staying silent about it.
137
+ - **A CDATA section (`<![CDATA[...]]>`) is read exactly like an ordinary text node everywhere in the XHTML reading path** — `xml/node.ts`'s `isTextLikeNode` is the one shared predicate every text-bearing walk in this package now dispatches on (`buildInlineRuns`, `readContainerChildren`'s own phrasing/block split, `readPre`'s three text-extraction paths, every stray-content collector in `read.ts`, and `xml/query.ts`'s own `decodedTextContent`), rather than each walk separately checking for `"text"` and quietly excluding `"cdata"`. A CDATA section is simply the alternate XML spelling a producer reaches for when its own literal text would otherwise need escaping (a code sample, or any other content containing a raw `<`/`&`) — exactly the kind of content a DocBook-to-EPUB pipeline or similar tool emits inside a `<pre>` — never a distinct kind of content, so treating the two differently was silently dropping real, well-formed input rather than a corpus-tolerance gap. The one place CDATA is genuinely _not_ interchangeable with a text node is entity decoding: `xml/entities.ts`'s `decodeTextLikeNode` decodes a text node's raw value exactly as before but returns a CDATA node's value untouched, since CDATA content is never subject to XML entity resolution in the first place — running it back through `decodeEntities` would corrupt exactly the unescaped content CDATA exists to carry. `xml/query.ts`'s own plain `textContent` is deliberately narrower and CDATA-blind: it is this package's long-standing published export, and a caller's own `decodeEntities(textContent(x))` idiom stays correct only because that walk never mixes in undecoded-by-design CDATA content for the wrap to misapply entity resolution to — the CDATA-aware, decode-internally behaviour lands as the distinctly named `decodedTextContent` instead, used by `opf/metadata.ts`'s own four Dublin Core readers, so upgrading to CDATA support never silently double-decodes an existing caller's text nodes.
136
138
  - **A blockquote containing a heading cannot carry its `division` construct** — a marker extent may not open or close a heading scope, and the last heading inside an extent always leaves one standing (`document-schema.js`'s own constraint) — so it degrades to indent-only structure (still `indentLeftPt`/`styleId: "Quote"`) while the heading keeps its own heading fidelity.
137
139
  - **Image dimensions are derived from pixel size via the CSS reference-pixel ratio (1px = 1/96in)**, not read from any `<img width>`/`<img height>` attribute or CSS: an EPUB's own XHTML/CSS carries no reliable point-based sizing of its own, so the image's natural pixel size is the one dimension every manifest image reliably has.
138
140
  - **A GIF or SVG manifest image is not yet decoded** — `document-schema.js`'s `ContentImageBlockSchema` widened its `format` field to admit `"svg"`/`"gif"` alongside `"png"`/`"jpeg"` specifically for this package's own manifest image kinds, but this package's reader does not yet decode either one; it degrades to alt text with an `epub/image-format-unsupported` diagnostic until that decode work lands.
package/dist/codec.d.cts CHANGED
@@ -1425,10 +1425,10 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1425
1425
  endColumn: z.ZodNumber;
1426
1426
  }, z.core.$strip>>;
1427
1427
  type: z.ZodEnum<{
1428
- date: "date";
1429
- custom: "custom";
1430
1428
  decimal: "decimal";
1431
1429
  list: "list";
1430
+ date: "date";
1431
+ custom: "custom";
1432
1432
  time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
package/dist/codec.d.ts CHANGED
@@ -1425,10 +1425,10 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1425
1425
  endColumn: z.ZodNumber;
1426
1426
  }, z.core.$strip>>;
1427
1427
  type: z.ZodEnum<{
1428
- date: "date";
1429
- custom: "custom";
1430
1428
  decimal: "decimal";
1431
1429
  list: "list";
1430
+ date: "date";
1431
+ custom: "custom";
1432
1432
  time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
@@ -18,10 +18,18 @@ declare const EpubDiagnosticCodes: {
18
18
  readonly IMAGE_FORMAT_UNSUPPORTED: "epub/image-format-unsupported";
19
19
  readonly IMAGE_UNRESOLVED: "epub/image-unresolved";
20
20
  readonly IMAGE_INLINE_UNSUPPORTED: "epub/image-inline-unsupported";
21
+ readonly IMAGE_PRE_UNSUPPORTED: "epub/image-pre-unsupported";
21
22
  readonly ELEMENT_UNMAPPED: "epub/element-unmapped";
22
23
  readonly STYLE_RESIDUE: "epub/style-residue";
23
24
  readonly FOOTNOTE_TARGET_UNRESOLVED: "epub/footnote-target-unresolved";
24
25
  readonly LINK_TARGET_EXTERNAL_ONLY: "epub/link-target-external-only";
26
+ readonly TABLE_CAPTION_UNSUPPORTED: "epub/table-caption-unsupported";
27
+ readonly TABLE_DUPLICATE_CAPTION: "epub/table-duplicate-caption";
28
+ readonly TABLE_ROW_CONTENT_OUTSIDE_CELL: "epub/table-row-content-outside-cell";
29
+ readonly TABLE_CONTENT_UNRECOGNIZED: "epub/table-content-unrecognized";
30
+ readonly LIST_CONTENT_OUTSIDE_ITEM: "epub/list-content-outside-item";
31
+ readonly DEFINITION_LIST_CONTENT_OUTSIDE_ENTRY: "epub/definition-list-content-outside-entry";
32
+ readonly NOSCRIPT_CONTENT_SKIPPED: "epub/noscript-content-skipped";
25
33
  readonly CONSTRUCT_UNREPRESENTED: "epub/construct-unrepresented";
26
34
  readonly INVENTED_PAGE_GEOMETRY: "epub/invented-page-geometry";
27
35
  };
@@ -18,10 +18,18 @@ declare const EpubDiagnosticCodes: {
18
18
  readonly IMAGE_FORMAT_UNSUPPORTED: "epub/image-format-unsupported";
19
19
  readonly IMAGE_UNRESOLVED: "epub/image-unresolved";
20
20
  readonly IMAGE_INLINE_UNSUPPORTED: "epub/image-inline-unsupported";
21
+ readonly IMAGE_PRE_UNSUPPORTED: "epub/image-pre-unsupported";
21
22
  readonly ELEMENT_UNMAPPED: "epub/element-unmapped";
22
23
  readonly STYLE_RESIDUE: "epub/style-residue";
23
24
  readonly FOOTNOTE_TARGET_UNRESOLVED: "epub/footnote-target-unresolved";
24
25
  readonly LINK_TARGET_EXTERNAL_ONLY: "epub/link-target-external-only";
26
+ readonly TABLE_CAPTION_UNSUPPORTED: "epub/table-caption-unsupported";
27
+ readonly TABLE_DUPLICATE_CAPTION: "epub/table-duplicate-caption";
28
+ readonly TABLE_ROW_CONTENT_OUTSIDE_CELL: "epub/table-row-content-outside-cell";
29
+ readonly TABLE_CONTENT_UNRECOGNIZED: "epub/table-content-unrecognized";
30
+ readonly LIST_CONTENT_OUTSIDE_ITEM: "epub/list-content-outside-item";
31
+ readonly DEFINITION_LIST_CONTENT_OUTSIDE_ENTRY: "epub/definition-list-content-outside-entry";
32
+ readonly NOSCRIPT_CONTENT_SKIPPED: "epub/noscript-content-skipped";
25
33
  readonly CONSTRUCT_UNREPRESENTED: "epub/construct-unrepresented";
26
34
  readonly INVENTED_PAGE_GEOMETRY: "epub/invented-page-geometry";
27
35
  };
@@ -11,10 +11,18 @@ const EpubDiagnosticCodes = {
11
11
  IMAGE_FORMAT_UNSUPPORTED: "epub/image-format-unsupported",
12
12
  IMAGE_UNRESOLVED: "epub/image-unresolved",
13
13
  IMAGE_INLINE_UNSUPPORTED: "epub/image-inline-unsupported",
14
+ IMAGE_PRE_UNSUPPORTED: "epub/image-pre-unsupported",
14
15
  ELEMENT_UNMAPPED: "epub/element-unmapped",
15
16
  STYLE_RESIDUE: "epub/style-residue",
16
17
  FOOTNOTE_TARGET_UNRESOLVED: "epub/footnote-target-unresolved",
17
18
  LINK_TARGET_EXTERNAL_ONLY: "epub/link-target-external-only",
19
+ TABLE_CAPTION_UNSUPPORTED: "epub/table-caption-unsupported",
20
+ TABLE_DUPLICATE_CAPTION: "epub/table-duplicate-caption",
21
+ TABLE_ROW_CONTENT_OUTSIDE_CELL: "epub/table-row-content-outside-cell",
22
+ TABLE_CONTENT_UNRECOGNIZED: "epub/table-content-unrecognized",
23
+ LIST_CONTENT_OUTSIDE_ITEM: "epub/list-content-outside-item",
24
+ DEFINITION_LIST_CONTENT_OUTSIDE_ENTRY: "epub/definition-list-content-outside-entry",
25
+ NOSCRIPT_CONTENT_SKIPPED: "epub/noscript-content-skipped",
18
26
  CONSTRUCT_UNREPRESENTED: "epub/construct-unrepresented",
19
27
  INVENTED_PAGE_GEOMETRY: "epub/invented-page-geometry"
20
28
  };
@@ -1,2 +1,2 @@
1
- import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-tvGwPH46.cjs";
1
+ import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-C0CRdoda.cjs";
2
2
  export { EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, NOOP_EPUB_DIAGNOSTIC_SINK };
@@ -1,2 +1,2 @@
1
- import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-tvGwPH46.js";
1
+ import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-C0CRdoda.js";
2
2
  export { EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, NOOP_EPUB_DIAGNOSTIC_SINK };
@@ -10,10 +10,18 @@ const EpubDiagnosticCodes = {
10
10
  IMAGE_FORMAT_UNSUPPORTED: "epub/image-format-unsupported",
11
11
  IMAGE_UNRESOLVED: "epub/image-unresolved",
12
12
  IMAGE_INLINE_UNSUPPORTED: "epub/image-inline-unsupported",
13
+ IMAGE_PRE_UNSUPPORTED: "epub/image-pre-unsupported",
13
14
  ELEMENT_UNMAPPED: "epub/element-unmapped",
14
15
  STYLE_RESIDUE: "epub/style-residue",
15
16
  FOOTNOTE_TARGET_UNRESOLVED: "epub/footnote-target-unresolved",
16
17
  LINK_TARGET_EXTERNAL_ONLY: "epub/link-target-external-only",
18
+ TABLE_CAPTION_UNSUPPORTED: "epub/table-caption-unsupported",
19
+ TABLE_DUPLICATE_CAPTION: "epub/table-duplicate-caption",
20
+ TABLE_ROW_CONTENT_OUTSIDE_CELL: "epub/table-row-content-outside-cell",
21
+ TABLE_CONTENT_UNRECOGNIZED: "epub/table-content-unrecognized",
22
+ LIST_CONTENT_OUTSIDE_ITEM: "epub/list-content-outside-item",
23
+ DEFINITION_LIST_CONTENT_OUTSIDE_ENTRY: "epub/definition-list-content-outside-entry",
24
+ NOSCRIPT_CONTENT_SKIPPED: "epub/noscript-content-skipped",
17
25
  CONSTRUCT_UNREPRESENTED: "epub/construct-unrepresented",
18
26
  INVENTED_PAGE_GEOMETRY: "epub/invented-page-geometry"
19
27
  };
package/dist/index.cjs CHANGED
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_diagnostics = require("./diagnostics.cjs");
3
+ const require_xml_entities = require("./xml/entities.cjs");
4
+ const require_xml_node = require("./xml/node.cjs");
3
5
  const require_xml_query = require("./xml/query.cjs");
4
6
  const require_xml_parse = require("./xml/parse.cjs");
5
7
  const require_ocf_container = require("./ocf/container.cjs");
@@ -7,12 +9,12 @@ const require_format = require("./format.cjs");
7
9
  const require_nav_nav3 = require("./nav/nav3.cjs");
8
10
  const require_nav_ncx = require("./nav/ncx.cjs");
9
11
  const require_nav_reconcile = require("./nav/reconcile.cjs");
10
- const require_xml_entities = require("./xml/entities.cjs");
11
12
  const require_opf_metadata = require("./opf/metadata.cjs");
12
13
  const require_opf_parse = require("./opf/parse.cjs");
13
14
  const require_image_dimensions = require("./image/dimensions.cjs");
14
15
  const require_util_base64 = require("./util/base64.cjs");
15
16
  const require_xml_build = require("./xml/build.cjs");
17
+ const require_xhtml_context = require("./xhtml/context.cjs");
16
18
  const require_xhtml_footnote = require("./xhtml/footnote.cjs");
17
19
  const require_xhtml_style_constants = require("./xhtml/style-constants.cjs");
18
20
  const require_xhtml_inline = require("./xhtml/inline.cjs");
@@ -28,8 +30,6 @@ const require_xhtml_write = require("./xhtml/write.cjs");
28
30
  const require_write = require("./write.cjs");
29
31
  const require_codec = require("./codec.cjs");
30
32
  require("./opf/types.cjs");
31
- require("./xhtml/context.cjs");
32
- const require_xml_node = require("./xml/node.cjs");
33
33
  exports.AttributeSchema = require_xml_node.AttributeSchema;
34
34
  exports.DEFINITION_BODY_INDENT_PT = require_xhtml_style_constants.DEFINITION_BODY_INDENT_PT;
35
35
  exports.EPUB_MIME_TYPE = require_format.EPUB_MIME_TYPE;
@@ -66,6 +66,8 @@ exports.buildXml = require_xml_build.buildXml;
66
66
  exports.bytesToBase64 = require_util_base64.bytesToBase64;
67
67
  exports.childrenWithTag = require_xml_query.childrenWithTag;
68
68
  exports.decodeEntities = require_xml_entities.decodeEntities;
69
+ exports.decodeTextLikeNode = require_xml_entities.decodeTextLikeNode;
70
+ exports.decodedTextContent = require_xml_query.decodedTextContent;
69
71
  exports.detectImageFormat = require_image_dimensions.detectImageFormat;
70
72
  exports.dirname = require_path.dirname;
71
73
  exports.elementsWithTag = require_xml_query.elementsWithTag;
@@ -76,6 +78,8 @@ exports.findChildElement = require_xml_query.findChildElement;
76
78
  exports.findElement = require_xml_query.findElement;
77
79
  exports.isFootnoteAside = require_xhtml_footnote.isFootnoteAside;
78
80
  exports.isFootnoteReferenceAnchor = require_xhtml_footnote.isFootnoteReferenceAnchor;
81
+ exports.isInertElement = require_xhtml_context.isInertElement;
82
+ exports.isTextLikeNode = require_xml_node.isTextLikeNode;
79
83
  exports.isXmlNode = require_xml_node.isXmlNode;
80
84
  exports.mintListNumId = require_xhtml_list_id.mintListNumId;
81
85
  exports.navMatchesSpine = require_nav_reconcile.navMatchesSpine;
@@ -89,6 +93,7 @@ exports.readNav3TocHrefs = require_nav_nav3.readNav3TocHrefs;
89
93
  exports.readNcxHrefs = require_nav_ncx.readNcxHrefs;
90
94
  exports.readOpfMetadata = require_opf_metadata.readOpfMetadata;
91
95
  exports.readXhtmlBody = require_xhtml_read.readXhtmlBody;
96
+ exports.reportInertElementSkip = require_xhtml_context.reportInertElementSkip;
92
97
  exports.resolveOpfPath = require_ocf_container.resolveOpfPath;
93
98
  exports.resolvePackagePath = require_path.resolvePackagePath;
94
99
  exports.rootElement = require_xml_query.rootElement;
package/dist/index.d.cts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { EpubBytesSchema, epubCodec, epubContentCodec } from "./codec.cjs";
2
- import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-tvGwPH46.cjs";
2
+ import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-C0CRdoda.cjs";
3
3
  import { EPUB_MIME_TYPE, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH } from "./format.cjs";
4
4
  import { EpubImageFormat, ImageDimensions, POINTS_PER_PIXEL, detectImageFormat, readImageDimensions } from "./image/dimensions.cjs";
5
5
  import { ZipEntry, unzipPackage, zipPackage } from "./zip.cjs";
6
6
  import { resolveOpfPath } from "./ocf/container.cjs";
7
7
  import { OpfManifestItem, OpfPackage, OpfSpineItemRef } from "./opf/types.cjs";
8
- import { Attribute, AttributeSchema, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, isXmlNode } from "./xml/node.cjs";
8
+ import { Attribute, AttributeSchema, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, isTextLikeNode, isXmlNode } from "./xml/node.cjs";
9
9
  import { readOpfMetadata } from "./opf/metadata.cjs";
10
10
  import { parseOpf } from "./opf/parse.cjs";
11
11
  import { WriteOpfInput, writeOpf } from "./opf/write.cjs";
12
12
  import { base64ToBytes, bytesToBase64 } from "./util/base64.cjs";
13
- import { InlineStyle, XhtmlReadContext } from "./xhtml/context.cjs";
13
+ import { InlineStyle, XhtmlReadContext, isInertElement, reportInertElementSkip } from "./xhtml/context.cjs";
14
14
  import { isFootnoteAside, isFootnoteReferenceAnchor, sameDocumentFragment } from "./xhtml/footnote.cjs";
15
15
  import { InlineResult, buildInlineRuns } from "./xhtml/inline.cjs";
16
16
  import { ListNumIdInfo, MintListNumIdOptions, mintListNumId, parseListNumId } from "./xhtml/list-id.cjs";
@@ -27,6 +27,6 @@ import { ReadEpubOptions, readEpub, readEpubContent } from "./read.cjs";
27
27
  import { WriteEpubOptions, writeEpub, writeEpubContent } from "./write.cjs";
28
28
  import { parseXml } from "./xml/parse.cjs";
29
29
  import { buildXml } from "./xml/build.cjs";
30
- import { attrValue, childrenWithTag, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.cjs";
31
- import { decodeEntities, encodeEntities } from "./xml/entities.cjs";
32
- export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
30
+ import { attrValue, childrenWithTag, decodedTextContent, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.cjs";
31
+ import { decodeEntities, decodeTextLikeNode, encodeEntities } from "./xml/entities.cjs";
32
+ export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { EpubBytesSchema, epubCodec, epubContentCodec } from "./codec.js";
2
- import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-tvGwPH46.js";
2
+ import { a as EpubEmptySpineError, c as EpubInvalidOpfError, d as EpubUnbalancedConstructMarkersError, f as EpubUnsupportedDocumentKindError, i as EpubDiagnosticSink, l as EpubPackageFlattenError, m as NOOP_EPUB_DIAGNOSTIC_SINK, n as EpubDiagnosticCodes, o as EpubInvalidContainerError, p as EpubWriteError, r as EpubDiagnosticSeverity, s as EpubInvalidMimetypeError, t as EpubDiagnostic, u as EpubParseError } from "./diagnostics-C0CRdoda.js";
3
3
  import { EPUB_MIME_TYPE, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH } from "./format.js";
4
4
  import { EpubImageFormat, ImageDimensions, POINTS_PER_PIXEL, detectImageFormat, readImageDimensions } from "./image/dimensions.js";
5
5
  import { ZipEntry, unzipPackage, zipPackage } from "./zip.js";
6
6
  import { resolveOpfPath } from "./ocf/container.js";
7
7
  import { OpfManifestItem, OpfPackage, OpfSpineItemRef } from "./opf/types.js";
8
- import { Attribute, AttributeSchema, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, isXmlNode } from "./xml/node.js";
8
+ import { Attribute, AttributeSchema, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, isTextLikeNode, isXmlNode } from "./xml/node.js";
9
9
  import { readOpfMetadata } from "./opf/metadata.js";
10
10
  import { parseOpf } from "./opf/parse.js";
11
11
  import { WriteOpfInput, writeOpf } from "./opf/write.js";
12
12
  import { base64ToBytes, bytesToBase64 } from "./util/base64.js";
13
- import { InlineStyle, XhtmlReadContext } from "./xhtml/context.js";
13
+ import { InlineStyle, XhtmlReadContext, isInertElement, reportInertElementSkip } from "./xhtml/context.js";
14
14
  import { isFootnoteAside, isFootnoteReferenceAnchor, sameDocumentFragment } from "./xhtml/footnote.js";
15
15
  import { InlineResult, buildInlineRuns } from "./xhtml/inline.js";
16
16
  import { ListNumIdInfo, MintListNumIdOptions, mintListNumId, parseListNumId } from "./xhtml/list-id.js";
@@ -27,6 +27,6 @@ import { ReadEpubOptions, readEpub, readEpubContent } from "./read.js";
27
27
  import { WriteEpubOptions, writeEpub, writeEpubContent } from "./write.js";
28
28
  import { parseXml } from "./xml/parse.js";
29
29
  import { buildXml } from "./xml/build.js";
30
- import { attrValue, childrenWithTag, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.js";
31
- import { decodeEntities, encodeEntities } from "./xml/entities.js";
32
- export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
30
+ import { attrValue, childrenWithTag, decodedTextContent, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.js";
31
+ import { decodeEntities, decodeTextLikeNode, encodeEntities } from "./xml/entities.js";
32
+ export { Attribute, AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnostic, EpubDiagnosticCodes, EpubDiagnosticSeverity, EpubDiagnosticSink, EpubEmptySpineError, EpubImageFormat, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, ImageDimensions, InlineResult, InlineStyle, ListNumIdInfo, MONOSPACE_FONT_FAMILY, MintListNumIdOptions, NOOP_EPUB_DIAGNOSTIC_SINK, NavSectionEntry, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, OpfManifestItem, OpfPackage, OpfSpineItemRef, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, ReadEpubOptions, ReadXhtmlBodyOptions, ReadXhtmlBodyResult, WriteEpubOptions, WriteOpfInput, XhtmlReadContext, XhtmlWriteContext, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, ZipEntry, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
package/dist/index.js CHANGED
@@ -1,17 +1,19 @@
1
1
  import { EpubDiagnosticCodes, EpubEmptySpineError, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, NOOP_EPUB_DIAGNOSTIC_SINK } from "./diagnostics.js";
2
- import { attrValue, childrenWithTag, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.js";
2
+ import { decodeEntities, decodeTextLikeNode, encodeEntities } from "./xml/entities.js";
3
+ import { AttributeSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPiSchema, XmlTextSchema, isTextLikeNode, isXmlNode } from "./xml/node.js";
4
+ import { attrValue, childrenWithTag, decodedTextContent, elementsWithTag, findChildElement, findElement, rootElement, textContent } from "./xml/query.js";
3
5
  import { parseXml } from "./xml/parse.js";
4
6
  import { resolveOpfPath } from "./ocf/container.js";
5
7
  import { EPUB_MIME_TYPE, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH } from "./format.js";
6
8
  import { readNav3TocHrefs } from "./nav/nav3.js";
7
9
  import { readNcxHrefs } from "./nav/ncx.js";
8
10
  import { navMatchesSpine } from "./nav/reconcile.js";
9
- import { decodeEntities, encodeEntities } from "./xml/entities.js";
10
11
  import { readOpfMetadata } from "./opf/metadata.js";
11
12
  import { parseOpf } from "./opf/parse.js";
12
13
  import { POINTS_PER_PIXEL, detectImageFormat, readImageDimensions } from "./image/dimensions.js";
13
14
  import { base64ToBytes, bytesToBase64 } from "./util/base64.js";
14
15
  import { buildXml } from "./xml/build.js";
16
+ import { isInertElement, reportInertElementSkip } from "./xhtml/context.js";
15
17
  import { isFootnoteAside, isFootnoteReferenceAnchor, sameDocumentFragment } from "./xhtml/footnote.js";
16
18
  import { DEFINITION_BODY_INDENT_PT, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID } from "./xhtml/style-constants.js";
17
19
  import { buildInlineRuns } from "./xhtml/inline.js";
@@ -27,6 +29,4 @@ import { writeXhtmlBody } from "./xhtml/write.js";
27
29
  import { writeEpub, writeEpubContent } from "./write.js";
28
30
  import { EpubBytesSchema, epubCodec, epubContentCodec } from "./codec.js";
29
31
  import "./opf/types.js";
30
- import "./xhtml/context.js";
31
- import { AttributeSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPiSchema, XmlTextSchema, isXmlNode } from "./xml/node.js";
32
- export { AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnosticCodes, EpubEmptySpineError, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, NOOP_EPUB_DIAGNOSTIC_SINK, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPiSchema, XmlTextSchema, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
32
+ export { AttributeSchema, DEFINITION_BODY_INDENT_PT, EPUB_MIME_TYPE, EpubBytesSchema, EpubDiagnosticCodes, EpubEmptySpineError, EpubInvalidContainerError, EpubInvalidMimetypeError, EpubInvalidOpfError, EpubPackageFlattenError, EpubParseError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, EpubWriteError, HORIZONTAL_RULE_STYLE_ID, MONOSPACE_FONT_FAMILY, NOOP_EPUB_DIAGNOSTIC_SINK, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH, POINTS_PER_PIXEL, QUOTE_INDENT_PT, QUOTE_STYLE_ID, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPiSchema, XmlTextSchema, attrValue, base64ToBytes, buildInlineRuns, buildXml, bytesToBase64, childrenWithTag, decodeEntities, decodeTextLikeNode, decodedTextContent, detectImageFormat, dirname, elementsWithTag, encodeEntities, epubCodec, epubContentCodec, findChildElement, findElement, isFootnoteAside, isFootnoteReferenceAnchor, isInertElement, isTextLikeNode, isXmlNode, mintListNumId, navMatchesSpine, parseListNumId, parseOpf, parseXml, readEpub, readEpubContent, readImageDimensions, readNav3TocHrefs, readNcxHrefs, readOpfMetadata, readXhtmlBody, reportInertElementSkip, resolveOpfPath, resolvePackagePath, rootElement, sameDocumentFragment, sectionTitle, textContent, unzipPackage, writeContainerXml, writeEpub, writeEpubContent, writeNav3Document, writeOpf, writeXhtmlBody, zipPackage };
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_diagnostics = require("../diagnostics.cjs");
3
3
  const require_xml_query = require("../xml/query.cjs");
4
- const require_xml_entities = require("../xml/entities.cjs");
5
4
  //#region src/opf/metadata.ts
6
5
  const UNMAPPED_DC_TAGS = [
7
6
  "dc:publisher",
@@ -17,9 +16,9 @@ function readOpfMetadata(metadataElement, sink) {
17
16
  });
18
17
  const title = firstElementText(metadataElement, "dc:title");
19
18
  if (title !== void 0) metadata.title = title;
20
- const creators = require_xml_query.childrenWithTag(metadataElement, "dc:creator").map((element) => require_xml_entities.decodeEntities(require_xml_query.textContent(element.children)).trim()).filter((value) => value.length > 0);
19
+ const creators = require_xml_query.childrenWithTag(metadataElement, "dc:creator").map((element) => require_xml_query.decodedTextContent(element.children).trim()).filter((value) => value.length > 0);
21
20
  if (creators.length > 0) metadata.author = creators.join("; ");
22
- const subjects = require_xml_query.childrenWithTag(metadataElement, "dc:subject").map((element) => require_xml_entities.decodeEntities(require_xml_query.textContent(element.children)).trim()).filter((value) => value.length > 0);
21
+ const subjects = require_xml_query.childrenWithTag(metadataElement, "dc:subject").map((element) => require_xml_query.decodedTextContent(element.children).trim()).filter((value) => value.length > 0);
23
22
  if (subjects.length > 0) metadata.keywords = subjects;
24
23
  const language = firstElementText(metadataElement, "dc:language");
25
24
  if (language !== void 0) metadata.language = language;
@@ -32,13 +31,13 @@ function readOpfMetadata(metadataElement, sink) {
32
31
  function firstElementText(parent, tag) {
33
32
  const element = require_xml_query.childrenWithTag(parent, tag)[0];
34
33
  if (element === void 0) return;
35
- const text = require_xml_entities.decodeEntities(require_xml_query.textContent(element.children)).trim();
34
+ const text = require_xml_query.decodedTextContent(element.children).trim();
36
35
  return text.length > 0 ? text : void 0;
37
36
  }
38
37
  function dctermsModified(metadataElement) {
39
38
  for (const meta of require_xml_query.childrenWithTag(metadataElement, "meta")) {
40
39
  if (require_xml_query.attrValue(meta, "property") === "dcterms:modified") {
41
- const text = require_xml_entities.decodeEntities(require_xml_query.textContent(meta.children)).trim();
40
+ const text = require_xml_query.decodedTextContent(meta.children).trim();
42
41
  if (text.length > 0) return text;
43
42
  }
44
43
  if (require_xml_query.attrValue(meta, "name") === "dcterms:modified") {
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "../diagnostics-tvGwPH46.cjs";
1
+ import { i as EpubDiagnosticSink } from "../diagnostics-C0CRdoda.cjs";
2
2
  import { XmlElement } from "../xml/node.cjs";
3
3
  import { LayoutMetadata } from "document-schema.js";
4
4
  //#region src/opf/metadata.d.ts
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "../diagnostics-tvGwPH46.js";
1
+ import { i as EpubDiagnosticSink } from "../diagnostics-C0CRdoda.js";
2
2
  import { XmlElement } from "../xml/node.js";
3
3
  import { LayoutMetadata } from "document-schema.js";
4
4
  //#region src/opf/metadata.d.ts
@@ -1,6 +1,5 @@
1
1
  import { EpubDiagnosticCodes } from "../diagnostics.js";
2
- import { attrValue, childrenWithTag, textContent } from "../xml/query.js";
3
- import { decodeEntities } from "../xml/entities.js";
2
+ import { attrValue, childrenWithTag, decodedTextContent } from "../xml/query.js";
4
3
  //#region src/opf/metadata.ts
5
4
  const UNMAPPED_DC_TAGS = [
6
5
  "dc:publisher",
@@ -16,9 +15,9 @@ function readOpfMetadata(metadataElement, sink) {
16
15
  });
17
16
  const title = firstElementText(metadataElement, "dc:title");
18
17
  if (title !== void 0) metadata.title = title;
19
- const creators = childrenWithTag(metadataElement, "dc:creator").map((element) => decodeEntities(textContent(element.children)).trim()).filter((value) => value.length > 0);
18
+ const creators = childrenWithTag(metadataElement, "dc:creator").map((element) => decodedTextContent(element.children).trim()).filter((value) => value.length > 0);
20
19
  if (creators.length > 0) metadata.author = creators.join("; ");
21
- const subjects = childrenWithTag(metadataElement, "dc:subject").map((element) => decodeEntities(textContent(element.children)).trim()).filter((value) => value.length > 0);
20
+ const subjects = childrenWithTag(metadataElement, "dc:subject").map((element) => decodedTextContent(element.children).trim()).filter((value) => value.length > 0);
22
21
  if (subjects.length > 0) metadata.keywords = subjects;
23
22
  const language = firstElementText(metadataElement, "dc:language");
24
23
  if (language !== void 0) metadata.language = language;
@@ -31,13 +30,13 @@ function readOpfMetadata(metadataElement, sink) {
31
30
  function firstElementText(parent, tag) {
32
31
  const element = childrenWithTag(parent, tag)[0];
33
32
  if (element === void 0) return;
34
- const text = decodeEntities(textContent(element.children)).trim();
33
+ const text = decodedTextContent(element.children).trim();
35
34
  return text.length > 0 ? text : void 0;
36
35
  }
37
36
  function dctermsModified(metadataElement) {
38
37
  for (const meta of childrenWithTag(metadataElement, "meta")) {
39
38
  if (attrValue(meta, "property") === "dcterms:modified") {
40
- const text = decodeEntities(textContent(meta.children)).trim();
39
+ const text = decodedTextContent(meta.children).trim();
41
40
  if (text.length > 0) return text;
42
41
  }
43
42
  if (attrValue(meta, "name") === "dcterms:modified") {
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "../diagnostics-tvGwPH46.cjs";
1
+ import { i as EpubDiagnosticSink } from "../diagnostics-C0CRdoda.cjs";
2
2
  import { OpfPackage } from "./types.cjs";
3
3
  //#region src/opf/parse.d.ts
4
4
  declare function parseOpf(opfXml: string, sink?: EpubDiagnosticSink): OpfPackage;
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "../diagnostics-tvGwPH46.js";
1
+ import { i as EpubDiagnosticSink } from "../diagnostics-C0CRdoda.js";
2
2
  import { OpfPackage } from "./types.js";
3
3
  //#region src/opf/parse.d.ts
4
4
  declare function parseOpf(opfXml: string, sink?: EpubDiagnosticSink): OpfPackage;
package/dist/read.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "./diagnostics-tvGwPH46.cjs";
1
+ import { i as EpubDiagnosticSink } from "./diagnostics-C0CRdoda.cjs";
2
2
  import { ContentDocument, DocumentTree } from "document-schema.js";
3
3
  //#region src/read.d.ts
4
4
  interface ReadEpubOptions {
package/dist/read.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "./diagnostics-tvGwPH46.js";
1
+ import { i as EpubDiagnosticSink } from "./diagnostics-C0CRdoda.js";
2
2
  import { ContentDocument, DocumentTree } from "document-schema.js";
3
3
  //#region src/read.d.ts
4
4
  interface ReadEpubOptions {
package/dist/write.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_diagnostics = require("./diagnostics.cjs");
3
+ const require_xml_entities = require("./xml/entities.cjs");
3
4
  const require_xml_parse = require("./xml/parse.cjs");
4
5
  const require_format = require("./format.cjs");
5
- const require_xml_entities = require("./xml/entities.cjs");
6
6
  const require_xml_build = require("./xml/build.cjs");
7
7
  const require_zip = require("./zip.cjs");
8
8
  const require_ocf_write = require("./ocf/write.cjs");
package/dist/write.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "./diagnostics-tvGwPH46.cjs";
1
+ import { i as EpubDiagnosticSink } from "./diagnostics-C0CRdoda.cjs";
2
2
  import { ContentDocument, DocumentTree } from "document-schema.js";
3
3
  //#region src/write.d.ts
4
4
  interface WriteEpubOptions {
package/dist/write.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "./diagnostics-tvGwPH46.js";
1
+ import { i as EpubDiagnosticSink } from "./diagnostics-C0CRdoda.js";
2
2
  import { ContentDocument, DocumentTree } from "document-schema.js";
3
3
  //#region src/write.d.ts
4
4
  interface WriteEpubOptions {
package/dist/write.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { EpubPackageFlattenError, EpubUnbalancedConstructMarkersError, EpubUnsupportedDocumentKindError, NOOP_EPUB_DIAGNOSTIC_SINK } from "./diagnostics.js";
2
+ import { encodeEntities } from "./xml/entities.js";
2
3
  import { parseXml } from "./xml/parse.js";
3
4
  import { EPUB_MIME_TYPE, OCF_CONTAINER_PATH, OCF_MIMETYPE_PATH } from "./format.js";
4
- import { encodeEntities } from "./xml/entities.js";
5
5
  import { buildXml } from "./xml/build.js";
6
6
  import { zipPackage } from "./zip.js";
7
7
  import { writeContainerXml } from "./ocf/write.js";
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_diagnostics = require("../diagnostics.cjs");
3
+ //#region src/xhtml/context.ts
4
+ function isInertElement(tag) {
5
+ return tag === "script" || tag === "template" || tag === "style" || tag === "noscript";
6
+ }
7
+ function reportInertElementSkip(tag, context) {
8
+ if (tag !== "noscript") return;
9
+ context.sink({
10
+ code: require_diagnostics.EpubDiagnosticCodes.NOSCRIPT_CONTENT_SKIPPED,
11
+ severity: "info",
12
+ message: "<noscript>'s own subtree is skipped rather than read as document content -- its markup can be a scripting-disabled reading system's genuine rendered content, or a producer's own 'please enable JavaScript' placeholder, and this package cannot tell the two apart from the markup alone",
13
+ href: context.sourceHref
14
+ });
15
+ }
16
+ //#endregion
17
+ exports.isInertElement = isInertElement;
18
+ exports.reportInertElementSkip = reportInertElementSkip;
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "../diagnostics-tvGwPH46.cjs";
1
+ import { i as EpubDiagnosticSink } from "../diagnostics-C0CRdoda.cjs";
2
2
  import { XmlElement } from "../xml/node.cjs";
3
3
  //#region src/xhtml/context.d.ts
4
4
  interface XhtmlReadContext {
@@ -16,5 +16,7 @@ interface InlineStyle {
16
16
  readonly strike?: boolean;
17
17
  readonly fontFamily?: string;
18
18
  }
19
+ declare function isInertElement(tag: string): boolean;
20
+ declare function reportInertElementSkip(tag: string, context: XhtmlReadContext): void;
19
21
  //#endregion
20
- export { InlineStyle, XhtmlReadContext };
22
+ export { InlineStyle, XhtmlReadContext, isInertElement, reportInertElementSkip };
@@ -1,4 +1,4 @@
1
- import { i as EpubDiagnosticSink } from "../diagnostics-tvGwPH46.js";
1
+ import { i as EpubDiagnosticSink } from "../diagnostics-C0CRdoda.js";
2
2
  import { XmlElement } from "../xml/node.js";
3
3
  //#region src/xhtml/context.d.ts
4
4
  interface XhtmlReadContext {
@@ -16,5 +16,7 @@ interface InlineStyle {
16
16
  readonly strike?: boolean;
17
17
  readonly fontFamily?: string;
18
18
  }
19
+ declare function isInertElement(tag: string): boolean;
20
+ declare function reportInertElementSkip(tag: string, context: XhtmlReadContext): void;
19
21
  //#endregion
20
- export { InlineStyle, XhtmlReadContext };
22
+ export { InlineStyle, XhtmlReadContext, isInertElement, reportInertElementSkip };
@@ -0,0 +1,16 @@
1
+ import { EpubDiagnosticCodes } from "../diagnostics.js";
2
+ //#region src/xhtml/context.ts
3
+ function isInertElement(tag) {
4
+ return tag === "script" || tag === "template" || tag === "style" || tag === "noscript";
5
+ }
6
+ function reportInertElementSkip(tag, context) {
7
+ if (tag !== "noscript") return;
8
+ context.sink({
9
+ code: EpubDiagnosticCodes.NOSCRIPT_CONTENT_SKIPPED,
10
+ severity: "info",
11
+ message: "<noscript>'s own subtree is skipped rather than read as document content -- its markup can be a scripting-disabled reading system's genuine rendered content, or a producer's own 'please enable JavaScript' placeholder, and this package cannot tell the two apart from the markup alone",
12
+ href: context.sourceHref
13
+ });
14
+ }
15
+ //#endregion
16
+ export { isInertElement, reportInertElementSkip };
@@ -1,7 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_diagnostics = require("../diagnostics.cjs");
3
- const require_xml_query = require("../xml/query.cjs");
4
3
  const require_xml_entities = require("../xml/entities.cjs");
4
+ const require_xml_node = require("../xml/node.cjs");
5
+ const require_xml_query = require("../xml/query.cjs");
6
+ const require_xhtml_context = require("./context.cjs");
5
7
  const require_xhtml_footnote = require("./footnote.cjs");
6
8
  const require_xhtml_style_constants = require("./style-constants.cjs");
7
9
  //#region src/xhtml/inline.ts
@@ -28,8 +30,8 @@ function buildInlineRuns(nodes, style, context) {
28
30
  const runs = [];
29
31
  const constructs = [];
30
32
  for (const node of nodes) {
31
- if (node.type === "text") {
32
- const text = normalizeWhitespace(require_xml_entities.decodeEntities(node.value));
33
+ if (require_xml_node.isTextLikeNode(node)) {
34
+ const text = normalizeWhitespace(require_xml_entities.decodeTextLikeNode(node));
33
35
  if (text.length > 0) runs.push(styledRun(text, style));
34
36
  continue;
35
37
  }
@@ -42,6 +44,10 @@ function buildInlineRuns(nodes, style, context) {
42
44
  };
43
45
  }
44
46
  function appendElement(element, style, context, runs, constructs) {
47
+ if (require_xhtml_context.isInertElement(element.tag)) {
48
+ require_xhtml_context.reportInertElementSkip(element.tag, context);
49
+ return;
50
+ }
45
51
  switch (element.tag) {
46
52
  case "strong":
47
53
  case "b":