marktip 0.7.1__tar.gz → 0.7.2__tar.gz

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 (34) hide show
  1. {marktip-0.7.1 → marktip-0.7.2}/CMakeLists.txt +1 -1
  2. {marktip-0.7.1 → marktip-0.7.2}/PKG-INFO +58 -7
  3. {marktip-0.7.1 → marktip-0.7.2}/README.md +57 -6
  4. {marktip-0.7.1 → marktip-0.7.2}/pyproject.toml +1 -1
  5. {marktip-0.7.1 → marktip-0.7.2}/src/ast.cpp +274 -30
  6. {marktip-0.7.1 → marktip-0.7.2}/src/ast.h +18 -3
  7. {marktip-0.7.1 → marktip-0.7.2}/src/errors.h +3 -2
  8. {marktip-0.7.1 → marktip-0.7.2}/src/marktip.cpp +19 -10
  9. {marktip-0.7.1 → marktip-0.7.2}/src/parser.cpp +28 -1
  10. {marktip-0.7.1 → marktip-0.7.2}/src/parser.h +1 -1
  11. marktip-0.7.2/tests/test_content_model.py +159 -0
  12. {marktip-0.7.1 → marktip-0.7.2}/tests/test_errors.py +91 -0
  13. marktip-0.7.2/tests/test_node_type_policy.py +100 -0
  14. marktip-0.7.2/tests/test_nul_normalization.py +176 -0
  15. {marktip-0.7.1 → marktip-0.7.2}/tests/test_strict.py +7 -4
  16. {marktip-0.7.1 → marktip-0.7.2}/.github/workflows/build-distributions.yml +0 -0
  17. {marktip-0.7.1 → marktip-0.7.2}/.gitignore +0 -0
  18. {marktip-0.7.1 → marktip-0.7.2}/LICENSE +0 -0
  19. {marktip-0.7.1 → marktip-0.7.2}/python/marktip/__init__.py +0 -0
  20. {marktip-0.7.1 → marktip-0.7.2}/scripts/benchmark.py +0 -0
  21. {marktip-0.7.1 → marktip-0.7.2}/src/serializer.cpp +0 -0
  22. {marktip-0.7.1 → marktip-0.7.2}/src/serializer.h +0 -0
  23. {marktip-0.7.1 → marktip-0.7.2}/tests/test_document.py +0 -0
  24. {marktip-0.7.1 → marktip-0.7.2}/tests/test_parse.py +0 -0
  25. {marktip-0.7.1 → marktip-0.7.2}/tests/test_roundtrip.py +0 -0
  26. {marktip-0.7.1 → marktip-0.7.2}/tests/test_serialize.py +0 -0
  27. {marktip-0.7.1 → marktip-0.7.2}/tests/test_uri_policy.py +0 -0
  28. {marktip-0.7.1 → marktip-0.7.2}/tests/test_validate.py +0 -0
  29. {marktip-0.7.1 → marktip-0.7.2}/third_party/md4c/LICENSE.md +0 -0
  30. {marktip-0.7.1 → marktip-0.7.2}/third_party/md4c/src/entity.c +0 -0
  31. {marktip-0.7.1 → marktip-0.7.2}/third_party/md4c/src/entity.h +0 -0
  32. {marktip-0.7.1 → marktip-0.7.2}/third_party/md4c/src/md4c.c +0 -0
  33. {marktip-0.7.1 → marktip-0.7.2}/third_party/md4c/src/md4c.h +0 -0
  34. {marktip-0.7.1 → marktip-0.7.2}/third_party/md4c/upstream_metadata/README.md +0 -0
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
7
7
  set(CMAKE_CXX_EXTENSIONS OFF)
8
8
 
9
9
  if(NOT DEFINED SKBUILD_PROJECT_VERSION)
10
- set(SKBUILD_PROJECT_VERSION "0.7.1")
10
+ set(SKBUILD_PROJECT_VERSION "0.7.2")
11
11
  endif()
12
12
 
13
13
  set(PYBIND11_FINDPYTHON ON)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: marktip
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: Fast C++/MD4C Markdown parser and canonical Markdown serializer for Tiptap-style JSON
5
5
  Keywords: markdown,tiptap,md4c,parser
6
6
  Author: Saneaven (Minjae Kyung)
@@ -104,9 +104,30 @@ doc = tm.from_markdown(untrusted, link_schemes=("https",), image_relative="rejec
104
104
  Violations raise `InvalidNodeError` with `.field` set to `"href"` or `"src"`.
105
105
  The options are keyword-only.
106
106
 
107
+ ### Rejecting node types
108
+
109
+ marktip's schema includes every node it can serialize, but an application may use a smaller ProseMirror dialect.
110
+ Both write boundaries accept `reject_node_types`, so that dialect can be enforced after either Markdown parsing or dict conversion without a second application-side tree walk:
111
+
112
+ ```python
113
+ NO_RAW_HTML = ("htmlBlock", "htmlInline")
114
+
115
+ doc = tm.from_dict(editor_json, reject_node_types=NO_RAW_HTML)
116
+ doc = tm.from_markdown(imported_markdown, reject_node_types=NO_RAW_HTML)
117
+ ```
118
+
119
+ `None` (the default) rejects nothing; an empty iterable has the same effect.
120
+ Every entry must name a node type marktip knows, and matching is exact and case-sensitive.
121
+ A bare string or a non-string entry raises `TypeError`; an unknown node name raises `ValueError`.
122
+ A document containing a configured type raises `InvalidNodeError` with `.code == "disallowed_node_type"`, `.field == "type"`, and `.path` locating the node.
123
+ The option is keyword-only.
124
+
125
+ This differs from `html=False`: `html=False` preserves raw markup as escaped literal text on Markdown input, while rejecting `htmlBlock`/`htmlInline` refuses markup that parsed as a raw-HTML node.
126
+ `reject_node_types` also works for dict input, where there is no parser flag.
127
+
107
128
  ### Refusing lossy conversions
108
129
 
109
- Node and mark *types* are closed, but `attrs` are not.
130
+ Node and mark *types* are always closed, but fields, attrs and content models are only closed when `strict` is enabled.
110
131
  An attr the serializer never reads is dropped without a word, so a `colspan: 2` cell quietly becomes a plain one:
111
132
 
112
133
  ```python
@@ -121,7 +142,7 @@ It is keyword-only and a `from_dict` option only — the parser emits nothing bu
121
142
  | `strict` | Keeps |
122
143
  | --- | --- |
123
144
  | `"off"` (default) | nothing is checked |
124
- | `"content"` | content and structure. Presentation an editor stamped on is type-checked and dropped |
145
+ | `"content"` | content and structure, including closed node fields and content models. Presentation an editor stamped on is type-checked and dropped |
125
146
  | `"exact"` | every attr the JSON carries |
126
147
 
127
148
  Both enabled levels also enforce the ProseMirror same-type self-exclusion rule on each node's marks.
@@ -129,6 +150,27 @@ The standard marks represented by marktip are self-exclusive, so a node cannot c
129
150
  The conflicting mark is rejected with `InvalidNodeError` rather than being serialized into Markdown that reparses with different formatting or structure.
130
151
  `strict="off"` skips this check because strict validation is disabled.
131
152
 
153
+ Both enabled levels reject a node or mark top-level key that its type does not declare (`unknown_field`), and enforce the following content models (`invalid_content`):
154
+
155
+ | Parent | Allowed children |
156
+ | --- | --- |
157
+ | `doc`, `blockquote`, `listItem`, `taskItem`, `tableCell`, `tableHeader` | block nodes |
158
+ | `paragraph`, `heading` | inline nodes (`text`, `hardBreak`, `image`, `htmlInline`) |
159
+ | `codeBlock` | unmarked `text` only |
160
+ | `bulletList` | `listItem` |
161
+ | `orderedList` | `listItem`, `taskItem` |
162
+ | `taskList` | `taskItem` |
163
+ | `table` | `tableRow` |
164
+ | `tableRow` | `tableHeader`, `tableCell` |
165
+ | `text`, `hardBreak`, `horizontalRule`, `image`, `htmlBlock`, `htmlInline` | none |
166
+
167
+ Block nodes are `paragraph`, `heading`, `blockquote`, `codeBlock`, `horizontalRule`, `bulletList`, `orderedList`, `taskList`, `table`, and `htmlBlock`.
168
+ A strict text node must carry a non-empty string `text` field.
169
+ This is marktip's canonical child grammar, not a verbatim copy of one editor's schema: in particular, ordered Markdown task items remain `orderedList` → `taskItem`, and empty parser-produced containers remain valid.
170
+ These rules prevent a nested block submitted inside a paragraph, content attached to a leaf, or an arbitrary child key from being silently flattened or omitted by the serializer.
171
+
172
+ > **Changed in 0.7.2** — `strict="content"` and `strict="exact"` now close node/mark top-level fields and per-node content models with `unknown_field` and `invalid_content`. `strict="off"` keeps the previous permissive converter behavior.
173
+
132
174
  > **Changed in 0.7.1** — `strict="content"` and `strict="exact"` now reject duplicate same-type marks with `invalid_mark_set`. Markdown parsing collapses nested spans that map to the same self-exclusive mark, so parser output remains valid on the strict read path.
133
175
 
134
176
  The two levels differ over one thing, and it is worth being precise about which:
@@ -234,6 +276,9 @@ For `from_markdown` it locates the node in the parsed document, since the input
234
276
  | `disallowed_scheme` | `InvalidNodeError` | a link `href` / image `src` scheme is outside the allowlist |
235
277
  | `disallowed_relative_url` | `InvalidNodeError` | a scheme-less `href`/`src` violates the relative policy |
236
278
  | `invalid_uri_char` | `InvalidNodeError` | an `href`/`src` contains an ASCII control character |
279
+ | `disallowed_node_type` | `InvalidNodeError` | a node type appears in `reject_node_types` |
280
+ | `unknown_field` | `InvalidNodeError` | `strict`: a node/mark top-level key is not defined for that type |
281
+ | `invalid_content` | `InvalidNodeError` | `strict`: a node violates its content model or text payload contract |
237
282
  | `unknown_attr` | `InvalidNodeError` | `strict`: the attr name is in neither dialect for that type |
238
283
  | `invalid_attr_value` | `InvalidNodeError` | `strict`: the attr's value has the wrong type or is out of range |
239
284
  | `unrepresentable` | `InvalidNodeError` | `strict`: the value is well-formed, but markdown cannot carry it |
@@ -243,7 +288,7 @@ For `from_markdown` it locates the node in the parsed document, since the input
243
288
  | `parse_failed` | `ParseError` | MD4C could not parse the input |
244
289
 
245
290
  `from_markdown` still raises a plain `TypeError` when the argument is not `str`/`bytes` — that is a caller bug, not a malformed document.
246
- So is a bad option value: a non-iterable `link_schemes` raises `TypeError`, and `link_schemes=("https://",)`, `link_relative="nope"` or `strict="strict"` raises `ValueError`.
291
+ So is a bad option value: a non-iterable `link_schemes` or `reject_node_types` raises `TypeError`, and `link_schemes=("https://",)`, `reject_node_types=("callout",)`, `link_relative="nope"` or `strict="strict"` raises `ValueError`.
247
292
  `strict` takes a level name, so `strict=True` raises `TypeError` rather than quietly meaning something.
248
293
 
249
294
  > **Changed in 0.4.0** — these were previously `ValueError` (`from_dict`) and `RuntimeError` (`from_markdown`).
@@ -275,9 +320,10 @@ It guarantees, for the whole tree:
275
320
  - **Depth** is at most 2048 levels.
276
321
  - **No ASCII control character** in a link `href` or image `src`, entity references included (`	`, `	`).
277
322
  - **The URI policy**, when `link_schemes`/`image_schemes`/`link_relative`/`image_relative` ask for it — see [Restricting link and image URIs](#restricting-link-and-image-uris).
323
+ - **The node-type policy**, when `reject_node_types` names a type — see [Rejecting node types](#rejecting-node-types).
278
324
 
279
325
  A document that survives `from_dict` always serializes; callers do not need to re-check any of the above.
280
- `from_markdown` enforces the same two URI rules on what it parses.
326
+ `from_markdown` enforces the same URI and rejected-node rules on what it parses.
281
327
 
282
328
  It deliberately does **not** validate, unless `strict` asks it to:
283
329
 
@@ -292,11 +338,15 @@ It deliberately does **not** validate, unless `strict` asks it to:
292
338
  - **Mark sets.**
293
339
  With strict validation disabled, two marks of the same type may appear on one node and are serialized independently.
294
340
  `strict="content"` and `strict="exact"` reject the second mark because marktip's standard ProseMirror/Tiptap marks are self-exclusive.
341
+ - **Node and mark top-level fields.**
342
+ With strict validation disabled, a key the converter does not read is ignored.
343
+ Both enabled levels reject it with `unknown_field`, including `marks` on a block or `text` on a non-text node.
295
344
  - **Content models.**
296
- Which node may contain which is not checked — a `text` node directly under `doc` is accepted and serialized.
345
+ With strict validation disabled, which node may contain which is not checked — a `text` node directly under `doc` is accepted and serialized.
346
+ Both enabled levels enforce the content-model table above, the text payload shape, and the absence of marks inside a code block.
297
347
  - **Raw HTML.**
298
348
  The URI policy governs `link` marks and `image` nodes, not markup inside `htmlBlock`/`htmlInline`, so `<a href="javascript:...">` passes it.
299
- Pair the policy with `html=False` to close that.
349
+ Reject those node types with `reject_node_types=("htmlBlock", "htmlInline")`; on Markdown input, `html=False` is the alternative that retains the markup as literal text.
300
350
  - **URI syntax beyond the scheme.**
301
351
  Everything after the scheme is opaque, and the stored value is never rewritten — an `href` is checked in its entity-decoded form but stored exactly as given.
302
352
  Under `link_relative="allow"` a protocol-relative `//evil.com/x` also passes, since it carries no scheme; `"path_only"` is the setting that rejects it.
@@ -318,6 +368,7 @@ except tm.InvalidNodeError as e:
318
368
  Markdown cannot represent every Tiptap document exactly.
319
369
  Rather than emitting or retaining a representation that changes on the next conversion, marktip applies these deterministic (and idempotent) normalizations during parsing and serialization:
320
370
 
371
+ - **NUL in content strings** — U+0000 in text or a non-URI string attr (`alt`, `title`, `language`, `html`, etc.) becomes U+FFFD. Markdown input is replaced once before tokenization, including inline/fenced/indented code and raw HTML, so reparsing cannot retain a NUL or accumulate replacement characters. On dict input, `link.href` and `image.src` are excluded and retain their unconditional `invalid_uri_char` rejection.
321
372
  - **Hard breaks in headings** — ATX headings are single-line, so a `hardBreak` (or a literal newline carried over from setext input) inside a heading serializes as a single space: `heading("a", hardBreak, "b")` → `# a b`.
322
373
  - **Multi-block table cells** — blocks inside a cell are joined with `<br>` and the cell is flattened to one line; two paragraphs in a cell reparse as one paragraph containing a `hardBreak`.
323
374
  - **Headerless tables** — GFM tables require a header row, so the first row is always emitted as the header; a leading `tableCell` row reparses as `tableHeader`.
@@ -76,9 +76,30 @@ doc = tm.from_markdown(untrusted, link_schemes=("https",), image_relative="rejec
76
76
  Violations raise `InvalidNodeError` with `.field` set to `"href"` or `"src"`.
77
77
  The options are keyword-only.
78
78
 
79
+ ### Rejecting node types
80
+
81
+ marktip's schema includes every node it can serialize, but an application may use a smaller ProseMirror dialect.
82
+ Both write boundaries accept `reject_node_types`, so that dialect can be enforced after either Markdown parsing or dict conversion without a second application-side tree walk:
83
+
84
+ ```python
85
+ NO_RAW_HTML = ("htmlBlock", "htmlInline")
86
+
87
+ doc = tm.from_dict(editor_json, reject_node_types=NO_RAW_HTML)
88
+ doc = tm.from_markdown(imported_markdown, reject_node_types=NO_RAW_HTML)
89
+ ```
90
+
91
+ `None` (the default) rejects nothing; an empty iterable has the same effect.
92
+ Every entry must name a node type marktip knows, and matching is exact and case-sensitive.
93
+ A bare string or a non-string entry raises `TypeError`; an unknown node name raises `ValueError`.
94
+ A document containing a configured type raises `InvalidNodeError` with `.code == "disallowed_node_type"`, `.field == "type"`, and `.path` locating the node.
95
+ The option is keyword-only.
96
+
97
+ This differs from `html=False`: `html=False` preserves raw markup as escaped literal text on Markdown input, while rejecting `htmlBlock`/`htmlInline` refuses markup that parsed as a raw-HTML node.
98
+ `reject_node_types` also works for dict input, where there is no parser flag.
99
+
79
100
  ### Refusing lossy conversions
80
101
 
81
- Node and mark *types* are closed, but `attrs` are not.
102
+ Node and mark *types* are always closed, but fields, attrs and content models are only closed when `strict` is enabled.
82
103
  An attr the serializer never reads is dropped without a word, so a `colspan: 2` cell quietly becomes a plain one:
83
104
 
84
105
  ```python
@@ -93,7 +114,7 @@ It is keyword-only and a `from_dict` option only — the parser emits nothing bu
93
114
  | `strict` | Keeps |
94
115
  | --- | --- |
95
116
  | `"off"` (default) | nothing is checked |
96
- | `"content"` | content and structure. Presentation an editor stamped on is type-checked and dropped |
117
+ | `"content"` | content and structure, including closed node fields and content models. Presentation an editor stamped on is type-checked and dropped |
97
118
  | `"exact"` | every attr the JSON carries |
98
119
 
99
120
  Both enabled levels also enforce the ProseMirror same-type self-exclusion rule on each node's marks.
@@ -101,6 +122,27 @@ The standard marks represented by marktip are self-exclusive, so a node cannot c
101
122
  The conflicting mark is rejected with `InvalidNodeError` rather than being serialized into Markdown that reparses with different formatting or structure.
102
123
  `strict="off"` skips this check because strict validation is disabled.
103
124
 
125
+ Both enabled levels reject a node or mark top-level key that its type does not declare (`unknown_field`), and enforce the following content models (`invalid_content`):
126
+
127
+ | Parent | Allowed children |
128
+ | --- | --- |
129
+ | `doc`, `blockquote`, `listItem`, `taskItem`, `tableCell`, `tableHeader` | block nodes |
130
+ | `paragraph`, `heading` | inline nodes (`text`, `hardBreak`, `image`, `htmlInline`) |
131
+ | `codeBlock` | unmarked `text` only |
132
+ | `bulletList` | `listItem` |
133
+ | `orderedList` | `listItem`, `taskItem` |
134
+ | `taskList` | `taskItem` |
135
+ | `table` | `tableRow` |
136
+ | `tableRow` | `tableHeader`, `tableCell` |
137
+ | `text`, `hardBreak`, `horizontalRule`, `image`, `htmlBlock`, `htmlInline` | none |
138
+
139
+ Block nodes are `paragraph`, `heading`, `blockquote`, `codeBlock`, `horizontalRule`, `bulletList`, `orderedList`, `taskList`, `table`, and `htmlBlock`.
140
+ A strict text node must carry a non-empty string `text` field.
141
+ This is marktip's canonical child grammar, not a verbatim copy of one editor's schema: in particular, ordered Markdown task items remain `orderedList` → `taskItem`, and empty parser-produced containers remain valid.
142
+ These rules prevent a nested block submitted inside a paragraph, content attached to a leaf, or an arbitrary child key from being silently flattened or omitted by the serializer.
143
+
144
+ > **Changed in 0.7.2** — `strict="content"` and `strict="exact"` now close node/mark top-level fields and per-node content models with `unknown_field` and `invalid_content`. `strict="off"` keeps the previous permissive converter behavior.
145
+
104
146
  > **Changed in 0.7.1** — `strict="content"` and `strict="exact"` now reject duplicate same-type marks with `invalid_mark_set`. Markdown parsing collapses nested spans that map to the same self-exclusive mark, so parser output remains valid on the strict read path.
105
147
 
106
148
  The two levels differ over one thing, and it is worth being precise about which:
@@ -206,6 +248,9 @@ For `from_markdown` it locates the node in the parsed document, since the input
206
248
  | `disallowed_scheme` | `InvalidNodeError` | a link `href` / image `src` scheme is outside the allowlist |
207
249
  | `disallowed_relative_url` | `InvalidNodeError` | a scheme-less `href`/`src` violates the relative policy |
208
250
  | `invalid_uri_char` | `InvalidNodeError` | an `href`/`src` contains an ASCII control character |
251
+ | `disallowed_node_type` | `InvalidNodeError` | a node type appears in `reject_node_types` |
252
+ | `unknown_field` | `InvalidNodeError` | `strict`: a node/mark top-level key is not defined for that type |
253
+ | `invalid_content` | `InvalidNodeError` | `strict`: a node violates its content model or text payload contract |
209
254
  | `unknown_attr` | `InvalidNodeError` | `strict`: the attr name is in neither dialect for that type |
210
255
  | `invalid_attr_value` | `InvalidNodeError` | `strict`: the attr's value has the wrong type or is out of range |
211
256
  | `unrepresentable` | `InvalidNodeError` | `strict`: the value is well-formed, but markdown cannot carry it |
@@ -215,7 +260,7 @@ For `from_markdown` it locates the node in the parsed document, since the input
215
260
  | `parse_failed` | `ParseError` | MD4C could not parse the input |
216
261
 
217
262
  `from_markdown` still raises a plain `TypeError` when the argument is not `str`/`bytes` — that is a caller bug, not a malformed document.
218
- So is a bad option value: a non-iterable `link_schemes` raises `TypeError`, and `link_schemes=("https://",)`, `link_relative="nope"` or `strict="strict"` raises `ValueError`.
263
+ So is a bad option value: a non-iterable `link_schemes` or `reject_node_types` raises `TypeError`, and `link_schemes=("https://",)`, `reject_node_types=("callout",)`, `link_relative="nope"` or `strict="strict"` raises `ValueError`.
219
264
  `strict` takes a level name, so `strict=True` raises `TypeError` rather than quietly meaning something.
220
265
 
221
266
  > **Changed in 0.4.0** — these were previously `ValueError` (`from_dict`) and `RuntimeError` (`from_markdown`).
@@ -247,9 +292,10 @@ It guarantees, for the whole tree:
247
292
  - **Depth** is at most 2048 levels.
248
293
  - **No ASCII control character** in a link `href` or image `src`, entity references included (`&Tab;`, `&#09;`).
249
294
  - **The URI policy**, when `link_schemes`/`image_schemes`/`link_relative`/`image_relative` ask for it — see [Restricting link and image URIs](#restricting-link-and-image-uris).
295
+ - **The node-type policy**, when `reject_node_types` names a type — see [Rejecting node types](#rejecting-node-types).
250
296
 
251
297
  A document that survives `from_dict` always serializes; callers do not need to re-check any of the above.
252
- `from_markdown` enforces the same two URI rules on what it parses.
298
+ `from_markdown` enforces the same URI and rejected-node rules on what it parses.
253
299
 
254
300
  It deliberately does **not** validate, unless `strict` asks it to:
255
301
 
@@ -264,11 +310,15 @@ It deliberately does **not** validate, unless `strict` asks it to:
264
310
  - **Mark sets.**
265
311
  With strict validation disabled, two marks of the same type may appear on one node and are serialized independently.
266
312
  `strict="content"` and `strict="exact"` reject the second mark because marktip's standard ProseMirror/Tiptap marks are self-exclusive.
313
+ - **Node and mark top-level fields.**
314
+ With strict validation disabled, a key the converter does not read is ignored.
315
+ Both enabled levels reject it with `unknown_field`, including `marks` on a block or `text` on a non-text node.
267
316
  - **Content models.**
268
- Which node may contain which is not checked — a `text` node directly under `doc` is accepted and serialized.
317
+ With strict validation disabled, which node may contain which is not checked — a `text` node directly under `doc` is accepted and serialized.
318
+ Both enabled levels enforce the content-model table above, the text payload shape, and the absence of marks inside a code block.
269
319
  - **Raw HTML.**
270
320
  The URI policy governs `link` marks and `image` nodes, not markup inside `htmlBlock`/`htmlInline`, so `<a href="javascript:...">` passes it.
271
- Pair the policy with `html=False` to close that.
321
+ Reject those node types with `reject_node_types=("htmlBlock", "htmlInline")`; on Markdown input, `html=False` is the alternative that retains the markup as literal text.
272
322
  - **URI syntax beyond the scheme.**
273
323
  Everything after the scheme is opaque, and the stored value is never rewritten — an `href` is checked in its entity-decoded form but stored exactly as given.
274
324
  Under `link_relative="allow"` a protocol-relative `//evil.com/x` also passes, since it carries no scheme; `"path_only"` is the setting that rejects it.
@@ -290,6 +340,7 @@ except tm.InvalidNodeError as e:
290
340
  Markdown cannot represent every Tiptap document exactly.
291
341
  Rather than emitting or retaining a representation that changes on the next conversion, marktip applies these deterministic (and idempotent) normalizations during parsing and serialization:
292
342
 
343
+ - **NUL in content strings** — U+0000 in text or a non-URI string attr (`alt`, `title`, `language`, `html`, etc.) becomes U+FFFD. Markdown input is replaced once before tokenization, including inline/fenced/indented code and raw HTML, so reparsing cannot retain a NUL or accumulate replacement characters. On dict input, `link.href` and `image.src` are excluded and retain their unconditional `invalid_uri_char` rejection.
293
344
  - **Hard breaks in headings** — ATX headings are single-line, so a `hardBreak` (or a literal newline carried over from setext input) inside a heading serializes as a single space: `heading("a", hardBreak, "b")` → `# a b`.
294
345
  - **Multi-block table cells** — blocks inside a cell are joined with `<br>` and the cell is flattened to one line; two paragraphs in a cell reparse as one paragraph containing a `hardBreak`.
295
346
  - **Headerless tables** — GFM tables require a header row, so the first row is always emitted as the header; a leading `tableCell` row reparses as `tableHeader`.
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "marktip"
7
- version = "0.7.1"
7
+ version = "0.7.2"
8
8
  description = "Fast C++/MD4C Markdown parser and canonical Markdown serializer for Tiptap-style JSON"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"