mdhtml 0.1.43__tar.gz → 0.1.45__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 (137) hide show
  1. {mdhtml-0.1.43 → mdhtml-0.1.45}/Cargo.lock +20 -20
  2. {mdhtml-0.1.43 → mdhtml-0.1.45}/Cargo.toml +1 -1
  3. {mdhtml-0.1.43 → mdhtml-0.1.45}/DEV.md +1 -1
  4. {mdhtml-0.1.43 → mdhtml-0.1.45}/PKG-INFO +33 -5
  5. {mdhtml-0.1.43 → mdhtml-0.1.45}/README.md +31 -3
  6. {mdhtml-0.1.43 → mdhtml-0.1.45}/docs/DIALECT.md +34 -3
  7. {mdhtml-0.1.43 → mdhtml-0.1.45}/docs/sample.html +21 -0
  8. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/sample-clean.md +14 -0
  9. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/sample-render.md +26 -0
  10. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/sample.md +16 -0
  11. {mdhtml-0.1.43 → mdhtml-0.1.45}/py/src/lib.rs +105 -60
  12. {mdhtml-0.1.43 → mdhtml-0.1.45}/pyproject.toml +1 -1
  13. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/export.py +7 -4
  14. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/md.py +6 -4
  15. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/md2html.py +2 -1
  16. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/readme.py +7 -2
  17. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/typst.py +21 -21
  18. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/viewmd.py +12 -5
  19. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/ast.rs +38 -6
  20. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/block.rs +30 -24
  21. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/chunk.rs +3 -2
  22. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/export_html.rs +9 -6
  23. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/frontmatter.rs +2 -1
  24. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/html.rs +8 -8
  25. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/import.rs +8 -5
  26. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/inline.rs +30 -42
  27. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/inline_spans.rs +3 -2
  28. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/lib.rs +1 -1
  29. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/markdown.rs +6 -5
  30. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/render.rs +43 -11
  31. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/resolve.rs +218 -84
  32. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/wikitext.rs +5 -4
  33. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/wrap.rs +3 -4
  34. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/write_md.rs +32 -8
  35. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/resolve.rs +61 -14
  36. mdhtml-0.1.45/tests/test_bibliography.py +64 -0
  37. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_export.py +3 -3
  38. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_focused.py +2 -2
  39. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_readme.py +4 -2
  40. {mdhtml-0.1.43 → mdhtml-0.1.45}/.cargo/config.toml +0 -0
  41. {mdhtml-0.1.43 → mdhtml-0.1.45}/.github/workflows/ci.yml +0 -0
  42. {mdhtml-0.1.43 → mdhtml-0.1.45}/.gitignore +0 -0
  43. {mdhtml-0.1.43 → mdhtml-0.1.45}/.nojekyll +0 -0
  44. {mdhtml-0.1.43 → mdhtml-0.1.45}/CHANGELOG.md +0 -0
  45. {mdhtml-0.1.43 → mdhtml-0.1.45}/LICENSE +0 -0
  46. {mdhtml-0.1.43 → mdhtml-0.1.45}/_config.yml +0 -0
  47. {mdhtml-0.1.43 → mdhtml-0.1.45}/_layouts/default.html +0 -0
  48. {mdhtml-0.1.43 → mdhtml-0.1.45}/docs/puppy.jpg +0 -0
  49. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/README.md +0 -0
  50. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/demo.md +0 -0
  51. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/examples.ipynb +0 -0
  52. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/filldemo.py +0 -0
  53. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo-bound.docx +0 -0
  54. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo-filled.md +0 -0
  55. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo-filled.pdf +0 -0
  56. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo-form.docx +0 -0
  57. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo-render.md +0 -0
  58. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo.docx +0 -0
  59. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo.html +0 -0
  60. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo.ipynb +0 -0
  61. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo.md +0 -0
  62. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo.pdf +0 -0
  63. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/legal_demo.typ +0 -0
  64. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/nbsample.ipynb +0 -0
  65. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/puppy.jpg +0 -0
  66. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/render_demo.py +0 -0
  67. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/sample.css +0 -0
  68. {mdhtml-0.1.43 → mdhtml-0.1.45}/examples/sample.js +0 -0
  69. {mdhtml-0.1.43 → mdhtml-0.1.45}/py/Cargo.toml +0 -0
  70. {mdhtml-0.1.43 → mdhtml-0.1.45}/py/build.rs +0 -0
  71. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/__init__.py +0 -0
  72. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/__main__.py +0 -0
  73. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/_cli.py +0 -0
  74. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/chunk.py +0 -0
  75. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/controls.html +0 -0
  76. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/fill.py +0 -0
  77. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/mustache.py +0 -0
  78. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/page.css +0 -0
  79. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/tools.py +0 -0
  80. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/view.css +0 -0
  81. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/view.js +0 -0
  82. {mdhtml-0.1.43 → mdhtml-0.1.45}/python/mdhtml/wrap.py +0 -0
  83. {mdhtml-0.1.43 → mdhtml-0.1.45}/rustfmt.toml +0 -0
  84. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/attrs.rs +0 -0
  85. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/diagnostic.rs +0 -0
  86. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/entity.rs +0 -0
  87. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/highlight.rs +0 -0
  88. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/line.rs +0 -0
  89. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/preview.css +0 -0
  90. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/scan.rs +0 -0
  91. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/template.rs +0 -0
  92. {mdhtml-0.1.43 → mdhtml-0.1.45}/src/tmpl.css +0 -0
  93. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/canonical.rs +0 -0
  94. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/fixtures/dialect.html +0 -0
  95. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/fixtures/dialect.md +0 -0
  96. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/helpers.py +0 -0
  97. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/cmark-gfm/README.md +0 -0
  98. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/cmark-gfm/extensions.txt +0 -0
  99. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/cmark-gfm/spec.txt +0 -0
  100. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/kramdown.txt +0 -0
  101. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/markdowntests.md +0 -0
  102. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/mf.txt +0 -0
  103. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/pandoc-grid-tables.txt +0 -0
  104. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Abbr.text +0 -0
  105. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Abbr.xhtml +0 -0
  106. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Backtick Fenced Code Blocks Special Cases.text +0 -0
  107. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Backtick Fenced Code Blocks Special Cases.xhtml +0 -0
  108. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Backtick Fenced Code Blocks.text +0 -0
  109. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Backtick Fenced Code Blocks.xhtml +0 -0
  110. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Definition Lists.text +0 -0
  111. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Definition Lists.xhtml +0 -0
  112. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Emphasis.text +0 -0
  113. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Emphasis.xhtml +0 -0
  114. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Footnotes.text +0 -0
  115. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Footnotes.xhtml +0 -0
  116. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Headers with attributes.text +0 -0
  117. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Headers with attributes.xhtml +0 -0
  118. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Inline HTML with Markdown content.text +0 -0
  119. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Inline HTML with Markdown content.xhtml +0 -0
  120. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Link & Image Attributes.text +0 -0
  121. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Link & Image Attributes.xhtml +0 -0
  122. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Tables.text +0 -0
  123. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Tables.xhtml +0 -0
  124. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Tilde Fenced Code Blocks Special Cases.text +0 -0
  125. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Tilde Fenced Code Blocks Special Cases.xhtml +0 -0
  126. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Tilde Fenced Code Blocks.text +0 -0
  127. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/source/php-markdown-extra.mdtest/Tilde Fenced Code Blocks.xhtml +0 -0
  128. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_chunk.py +0 -0
  129. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_conformance.py +0 -0
  130. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_fill.py +0 -0
  131. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_pathological.py +0 -0
  132. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_python.py +0 -0
  133. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_typst.py +0 -0
  134. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/test_wrap.py +0 -0
  135. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/wasm.mjs +0 -0
  136. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/wikitext.rs +0 -0
  137. {mdhtml-0.1.43 → mdhtml-0.1.45}/tests/wrap.rs +0 -0
@@ -114,9 +114,9 @@ dependencies = [
114
114
 
115
115
  [[package]]
116
116
  name = "log"
117
- version = "0.4.34"
117
+ version = "0.4.35"
118
118
  source = "registry+https://github.com/rust-lang/crates.io-index"
119
- checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
119
+ checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
120
120
 
121
121
  [[package]]
122
122
  name = "markup5ever"
@@ -131,7 +131,7 @@ dependencies = [
131
131
 
132
132
  [[package]]
133
133
  name = "mdhtml-crate"
134
- version = "0.1.43"
134
+ version = "0.1.45"
135
135
  dependencies = [
136
136
  "base64",
137
137
  "fast5ever",
@@ -141,7 +141,7 @@ dependencies = [
141
141
 
142
142
  [[package]]
143
143
  name = "mdhtml-py"
144
- version = "0.1.43"
144
+ version = "0.1.45"
145
145
  dependencies = [
146
146
  "mdhtml-crate",
147
147
  "pyo3",
@@ -150,7 +150,7 @@ dependencies = [
150
150
 
151
151
  [[package]]
152
152
  name = "mdhtml-wasm"
153
- version = "0.1.43"
153
+ version = "0.1.45"
154
154
  dependencies = [
155
155
  "mdhtml-crate",
156
156
  ]
@@ -383,9 +383,9 @@ dependencies = [
383
383
 
384
384
  [[package]]
385
385
  name = "serde_spanned"
386
- version = "1.1.2"
386
+ version = "1.1.3"
387
387
  source = "registry+https://github.com/rust-lang/crates.io-index"
388
- checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
388
+ checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782"
389
389
  dependencies = [
390
390
  "serde_core",
391
391
  ]
@@ -398,9 +398,9 @@ checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256"
398
398
 
399
399
  [[package]]
400
400
  name = "smallvec"
401
- version = "1.16.4"
401
+ version = "1.16.5"
402
402
  source = "registry+https://github.com/rust-lang/crates.io-index"
403
- checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
403
+ checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46"
404
404
 
405
405
  [[package]]
406
406
  name = "string_cache"
@@ -454,9 +454,9 @@ dependencies = [
454
454
 
455
455
  [[package]]
456
456
  name = "toml"
457
- version = "1.1.8+spec-1.1.0"
457
+ version = "1.2.1+spec-1.1.0"
458
458
  source = "registry+https://github.com/rust-lang/crates.io-index"
459
- checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
459
+ checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7"
460
460
  dependencies = [
461
461
  "indexmap",
462
462
  "serde_core",
@@ -469,9 +469,9 @@ dependencies = [
469
469
 
470
470
  [[package]]
471
471
  name = "toml_datetime"
472
- version = "1.1.2+spec-1.1.0"
472
+ version = "1.1.3+spec-1.1.0"
473
473
  source = "registry+https://github.com/rust-lang/crates.io-index"
474
- checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
474
+ checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49"
475
475
  dependencies = [
476
476
  "serde_core",
477
477
  ]
@@ -487,9 +487,9 @@ dependencies = [
487
487
 
488
488
  [[package]]
489
489
  name = "toml_writer"
490
- version = "1.1.3+spec-1.1.0"
490
+ version = "1.2.0+spec-1.1.0"
491
491
  source = "registry+https://github.com/rust-lang/crates.io-index"
492
- checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
492
+ checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a"
493
493
 
494
494
  [[package]]
495
495
  name = "unicode-ident"
@@ -499,9 +499,9 @@ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
499
499
 
500
500
  [[package]]
501
501
  name = "unicode-properties"
502
- version = "0.1.4"
502
+ version = "0.1.5"
503
503
  source = "registry+https://github.com/rust-lang/crates.io-index"
504
- checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
504
+ checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833"
505
505
 
506
506
  [[package]]
507
507
  name = "web_atoms"
@@ -523,13 +523,13 @@ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
523
523
 
524
524
  [[package]]
525
525
  name = "winnow"
526
- version = "1.0.4"
526
+ version = "1.0.5"
527
527
  source = "registry+https://github.com/rust-lang/crates.io-index"
528
- checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
528
+ checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef"
529
529
 
530
530
  [[package]]
531
531
  name = "xtask"
532
- version = "0.1.43"
532
+ version = "0.1.45"
533
533
  dependencies = [
534
534
  "anyhow",
535
535
  "serde_json",
@@ -2,7 +2,7 @@
2
2
  members = ["py"]
3
3
 
4
4
  [workspace.package]
5
- version = "0.1.43"
5
+ version = "0.1.45"
6
6
  edition = "2024"
7
7
  rust-version = "1.91"
8
8
  license = "Apache-2.0"
@@ -57,7 +57,7 @@ The Python binding uses public semantic model, encoder, writer and resolver APIs
57
57
 
58
58
  Public conversion names use `x2y`, with both representations explicit: `md2mdhtml`, `mdhtml2md`, `wiki2mdhtml`, `md2gfm`, `mdhtml2gfm`, `mdhtml2html`, `mdhtml2typst`, `mdhtml2pdf`, external `mdhtml2docx`, `md2dom`, and `mdhtml2dom`. Operations within a representation, including `bake_mdhtml`, `blocks`, `rewrite`, and `fill_md`, keep ordinary verbs.
59
59
 
60
- `src/write_md.rs` contains one Document-based md/GFM writer. `mdhtml2md` and `dom2md` import HTML then call it; they have no separate serializer. `resolve::bake_document` assigns numbers and static reference text for HTML/GFM. `ReferenceIndex::plan` supplies validation, target kinds, prefixes, grouping and variants to live-reference Typst/DOCX exporters without baking their references. Python retains an immutable native Document and projects values for format-specific emission.
60
+ `src/write_md.rs` contains one Document-based md/GFM writer. `mdhtml2md` and `dom2md` import HTML then call it; they have no separate serializer. `resolve::prepare_document` assigns numbers, lowers bibliography layout and resolves citations, returning the reference index and warnings. `ReferenceIndex::plan` supplies ordinary inline content and native-field instructions. Typst/DOCX consume this plan without citation-specific logic. `resolve::bake_document` also resolves the remaining cross-references for static formats. Python retains an immutable native Document and projects values for format-specific emission. Bibliography records contain explicit citation-author text, optional year text and formatted block bodies; no bibliographic fields are inferred from prose.
61
61
 
62
62
  `Document.frontmatter` retains the complete recognized fenced YAML. `Document::meta()` derives simple flat string pairs. Python's MDHTML result carries the same `frontmatter` and exposes a derived read-only `meta` mapping. Recognition and splitting live in `src/frontmatter.rs`; filling parses the selected payload with the existing string-preserving loader. Notebook metadata selection and merging remain notebook-specific.
63
63
 
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdhtml
3
- Version: 0.1.43
3
+ Version: 0.1.45
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Requires-Dist: fast5ever>=0.1.5
7
7
  Requires-Dist: fastcore>=2.2.7
8
8
  Requires-Dist: aidialog>=0.0.22
9
- Requires-Dist: aihist>=0.1.0
9
+ Requires-Dist: aihist>=0.1.3
10
10
  Requires-Dist: pyyaml>=6.0.3
11
11
  Requires-Dist: fastws-cli>=0.0.20 ; extra == 'dev'
12
12
  Requires-Dist: fastship>=0.1.5 ; extra == 'dev'
@@ -67,6 +67,7 @@ The dialect deviates from CommonMark for three reasons:
67
67
  - Raw passthrough: a Pandoc-style raw attribute names the payload's format. Use exactly `{=name}` as a fenced code block's info string or immediately after inline code. Both forms render as an inert `<script type="application/vnd.mdhtml.raw" data-format="name">`. Payload text stays literal unless it contains an HTML script-data hazard. [The dialect specification](docs/DIALECT.md#converter-specific-raw-data) defines the encoding rule.
68
68
  - Template tokens: Jinja, Mustache, or other configured delimiters. Token recognition is opt-in. Tokens become semantic operations in inert HTML template elements. Overlapping opening delimiters use the longest match. Optional balanced scanning handles nested expressions.
69
69
  - Cross-references: Quarto-style bracketed references to identified elements. `[@sec-pay]` renders as `<a data-ref href="#sec-pay"></a>`. Each converter resolves the reference for its output format. `[-@sec-pay]` adds the independent `bare` token. `[Clause @sec-pay]` supplies override text. `[@sec-a; @sec-b]` groups references in a `span` marked with `data-refs`. A trailing `{ref=page}` selects the `page` variant. The parser never resolves numbers or checks that targets exist.
70
+ - Bibliographies: `::: bibliography` contains a definition list. Each term supplies citation-author text, an id, and optional `year` text. Each definition supplies a formatted `md` entry. Citations use the existing reference syntax, with author-year or numeric presentation.
70
71
  - Table captions and figures: place `: caption {attrs}` immediately after the table's last row, with no blank line. This uses Quarto's caption format but requires the caption to follow the table. The attributes apply to the table. With `implicit_figures=True`, a paragraph containing only one image becomes a Figure with a structured caption and plain-text image alt. The image's id and classes move to the Figure. Both the caption and original alt are retained by MDHTML encoding.
71
72
  - Inline footnotes: pandoc-style `^[an inline note]`, numbered together with `[^id]` references.
72
73
 
@@ -147,6 +148,8 @@ Use `--head` to inline additional `.css` and `.js` files. `examples/sample.css`
147
148
 
148
149
  Pass a `.ipynb` file to view a Jupyter notebook. Code cells appear as highlighted Python blocks. A bordered `output` section below each cell shows its stored outputs. Streams, results, and tracebacks appear as text. HTML display objects, such as DataFrames, render as HTML. Images are inlined. Markdown cells support cross-references, footnotes, math, and frontmatter. See `examples/nbsample.ipynb` for a demonstration.
149
150
 
151
+ Use `--fill` to view a Markdown or notebook template filled from its `formdata`. This executes the template's participating code, as `fillmd` does. Unresolved fields remain visible and produce warnings. Filled notebooks use exported messages when any exist, otherwise non-pinned messages.
152
+
150
153
  In Solveit dialogs, each prompt appears in a bordered `prompt` section. Its AI reply is indented below it in a `reply` section. Tool calls encoded as fastllm fenced JSON blocks appear as folded details with code-span labels.
151
154
 
152
155
  ```bash
@@ -154,6 +157,7 @@ viewmd README.md
154
157
  viewmd draft.md --refs=ids
155
158
  viewmd examples/sample.md --head examples/sample.css --head examples/sample.js
156
159
  viewmd examples/nbsample.ipynb
160
+ viewmd template.ipynb --fill
157
161
  ```
158
162
 
159
163
  ### Filling templates
@@ -241,12 +245,36 @@ typst = mdhtml2typst(document)
241
245
  - Math has `tex`; inline math also has `display`. References have symbolic `items`, each with a target, tokens and optional authored prefix.
242
246
  - Operations have `syntax`, `action`, `name`, block-capable `args`, and an optional selected `content` argument index. Their operands are inert unless a renderer explicitly uses them.
243
247
 
244
- `document.bake(...)` returns a new Document with assigned numbers and reference text computed in Rust. It accepts `reftypes`, `number_headings`, `refs` and `links`. `document.index(...)` instead supplies target information and a validated reference `plan` for native live fields. Typst and DOCX use that plan without baking their references.
248
+ `document.bake(...)` returns a new Document with assigned numbers and reference text computed in Rust. It accepts `reftypes`, `number_headings`, `refs`, `links` and `cite_style`. `document.index(...)` supplies target information. `document.prepare(...)` returns `(document, index)` with citation text and bibliography layout prepared, retaining symbolic cross-references. Typst and DOCX render the index's shared plan of ordinary inline content and native `reference_field` instructions. Section and page fields remain live.
245
249
 
246
250
  `document.mdhtml(callbacks=...)` encodes MDHTML; `document.markdown()` writes canonical md. For GFM, use `document.bake(links=False).markdown(gfm=True, tmpl=...)` or the `mdhtml2gfm` convenience. `document.map_urls(callback)` returns a rewritten Document and leaves operation operands inert. Complete YAML, derived `meta`, and `warnings` remain attached.
247
251
 
248
252
  `Document.from_mdhtml(...)` and `import_mdhtml(...)` import symbolic MDHTML. Finished numbered output is not symbolic interchange input. Import normalizes a complete HTML5 fragment, not individual tag strings. Source positions and spellings remain available separately through `blocks`, `inlines`, and `rewrite`.
249
253
 
254
+ ### Citations and bibliographies
255
+
256
+ ```markdown
257
+ The method builds on [@howard2018]. [@howard2018]{ref=text} report the results. See also [see @merity2017, p. 3].
258
+
259
+ ::: bibliography
260
+ Howard and Ruder {#howard2018 year=2018}
261
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*. Proceedings of ACL.
262
+
263
+ Merity et al. {#merity2017 year=forthcoming}
264
+ : Stephen Merity et al. *Regularizing and Optimizing LSTM Language Models*.
265
+ :::
266
+ ```
267
+
268
+ The term is explicit citation-author text. `year` is an optional string, including values such as `2018a`, `n.d.` or `forthcoming`. The definition is the complete formatted entry. No author names, dates, or publication fields are inferred from prose. Bibliography generators own entry formatting, author abbreviation and date disambiguation. Definitions use the dialect's existing single-line definition syntax.
269
+
270
+ `[@howard2018]` produces `(Howard and Ruder, 2018)`. `{ref=text}` selects `Howard and Ruder (2018)`. `[-@howard2018]` suppresses the author and produces `(2018)`. Prefix and suffix text are supported per item, as in `[see @howard2018, p. 3; @merity2017]`. Ordinary cross-references also retain suffix text.
271
+
272
+ Use frontmatter `cite_style: numeric`, or `cite_style='numeric'` on an exporter, for `[1]` citations and numbered entries. Author-year is the default. Numbers follow bibliography order across the document, all entries remain included, and citation groups retain their authored order. HTML, GFM, Typst, PDF, DOCX and terminal output share the Rust preparation machinery. Exporter options override frontmatter.
273
+
274
+ Bibliography entries expose `attrs`, inline `author`, optional `year` and block `body` in `Document.blocks`. Canonical md and symbolic MDHTML retain these fields. Preparation lowers bibliography layout to ordinary blocks and citations to ordinary text and links. A prepared document no longer contains the original citation data. Change styles by preparing the original document again.
275
+
276
+ An entry requires an id and author text. A malformed bibliography, duplicate target id, unknown citation style, or invalid reference produces a conversion error. `refs='lenient'` preserves unresolved references as ids with warnings. Citation groups cannot mix bibliography entries and other targets. A narrative citation requires one work and no prefix. Citations do not support `page`, `leaf`, or `rel`.
277
+
250
278
  ### md chunks
251
279
 
252
280
  Choose among three chunking algorithms:
@@ -544,7 +572,7 @@ html = mdhtml2html(md2mdhtml(markdown), number_headings='legal')
544
572
 
545
573
  In `resolve` mode, cross-references become links with resolved text. `[@sec-pay]` becomes `<a href="#sec-pay">Section 1.</a>`. Groups use text such as "Sections 1. and 1.(a)". Figure and table references use text such as "Figure 1".
546
574
 
547
- `reftypes=dict(exh=('Exhibit', 'Exhibits'))` adds prefix words to the built-in `sec`, `fig`, `tbl`, and `eq` types. Missing targets, unknown tokens, and unknown types that need a prefix raise errors. The Word-only `page` and `rel` variants display the full number.
575
+ The built-in reference types are `sec` (Section/Sections), `fig` (Figure/Figures), `tbl` (Table/Tables), `eq` (Equation/Equations), and `exh` (Exhibit/Exhibits). Use `reftypes=dict(app=('Appendix', 'Appendices'))` to add prefix words for another type. Missing targets, unknown tokens, and unknown types that need a prefix raise errors. The Word-only `page` and `rel` variants display the full number.
548
576
 
549
577
  Two other modes support previews and drafts:
550
578
 
@@ -662,7 +690,7 @@ cat input.md | md2mdhtml --math=dollars
662
690
  from mdhtml import mdhtml2pdf, mdhtml2typst
663
691
 
664
692
  typ = mdhtml2typst(md2mdhtml(markdown), number_headings='legal')
665
- mdhtml2pdf(md2mdhtml(markdown), 'out.pdf', reftypes=dict(exh=('Exhibit', 'Exhibits')))
693
+ mdhtml2pdf(md2mdhtml(markdown), 'out.pdf')
666
694
  ```
667
695
 
668
696
  Typst resolves references at compile time. `[@sec-pay]` becomes `#ref(<sec-pay>, supplement: [Section])`. Reference numbers update when you edit and recompile the `.typ` file. This differs from exporters that resolve reference text during export.
@@ -35,6 +35,7 @@ The dialect deviates from CommonMark for three reasons:
35
35
  - Raw passthrough: a Pandoc-style raw attribute names the payload's format. Use exactly `{=name}` as a fenced code block's info string or immediately after inline code. Both forms render as an inert `<script type="application/vnd.mdhtml.raw" data-format="name">`. Payload text stays literal unless it contains an HTML script-data hazard. [The dialect specification](docs/DIALECT.md#converter-specific-raw-data) defines the encoding rule.
36
36
  - Template tokens: Jinja, Mustache, or other configured delimiters. Token recognition is opt-in. Tokens become semantic operations in inert HTML template elements. Overlapping opening delimiters use the longest match. Optional balanced scanning handles nested expressions.
37
37
  - Cross-references: Quarto-style bracketed references to identified elements. `[@sec-pay]` renders as `<a data-ref href="#sec-pay"></a>`. Each converter resolves the reference for its output format. `[-@sec-pay]` adds the independent `bare` token. `[Clause @sec-pay]` supplies override text. `[@sec-a; @sec-b]` groups references in a `span` marked with `data-refs`. A trailing `{ref=page}` selects the `page` variant. The parser never resolves numbers or checks that targets exist.
38
+ - Bibliographies: `::: bibliography` contains a definition list. Each term supplies citation-author text, an id, and optional `year` text. Each definition supplies a formatted `md` entry. Citations use the existing reference syntax, with author-year or numeric presentation.
38
39
  - Table captions and figures: place `: caption {attrs}` immediately after the table's last row, with no blank line. This uses Quarto's caption format but requires the caption to follow the table. The attributes apply to the table. With `implicit_figures=True`, a paragraph containing only one image becomes a Figure with a structured caption and plain-text image alt. The image's id and classes move to the Figure. Both the caption and original alt are retained by MDHTML encoding.
39
40
  - Inline footnotes: pandoc-style `^[an inline note]`, numbered together with `[^id]` references.
40
41
 
@@ -115,6 +116,8 @@ Use `--head` to inline additional `.css` and `.js` files. `examples/sample.css`
115
116
 
116
117
  Pass a `.ipynb` file to view a Jupyter notebook. Code cells appear as highlighted Python blocks. A bordered `output` section below each cell shows its stored outputs. Streams, results, and tracebacks appear as text. HTML display objects, such as DataFrames, render as HTML. Images are inlined. Markdown cells support cross-references, footnotes, math, and frontmatter. See `examples/nbsample.ipynb` for a demonstration.
117
118
 
119
+ Use `--fill` to view a Markdown or notebook template filled from its `formdata`. This executes the template's participating code, as `fillmd` does. Unresolved fields remain visible and produce warnings. Filled notebooks use exported messages when any exist, otherwise non-pinned messages.
120
+
118
121
  In Solveit dialogs, each prompt appears in a bordered `prompt` section. Its AI reply is indented below it in a `reply` section. Tool calls encoded as fastllm fenced JSON blocks appear as folded details with code-span labels.
119
122
 
120
123
  ```bash
@@ -122,6 +125,7 @@ viewmd README.md
122
125
  viewmd draft.md --refs=ids
123
126
  viewmd examples/sample.md --head examples/sample.css --head examples/sample.js
124
127
  viewmd examples/nbsample.ipynb
128
+ viewmd template.ipynb --fill
125
129
  ```
126
130
 
127
131
  ### Filling templates
@@ -209,12 +213,36 @@ typst = mdhtml2typst(document)
209
213
  - Math has `tex`; inline math also has `display`. References have symbolic `items`, each with a target, tokens and optional authored prefix.
210
214
  - Operations have `syntax`, `action`, `name`, block-capable `args`, and an optional selected `content` argument index. Their operands are inert unless a renderer explicitly uses them.
211
215
 
212
- `document.bake(...)` returns a new Document with assigned numbers and reference text computed in Rust. It accepts `reftypes`, `number_headings`, `refs` and `links`. `document.index(...)` instead supplies target information and a validated reference `plan` for native live fields. Typst and DOCX use that plan without baking their references.
216
+ `document.bake(...)` returns a new Document with assigned numbers and reference text computed in Rust. It accepts `reftypes`, `number_headings`, `refs`, `links` and `cite_style`. `document.index(...)` supplies target information. `document.prepare(...)` returns `(document, index)` with citation text and bibliography layout prepared, retaining symbolic cross-references. Typst and DOCX render the index's shared plan of ordinary inline content and native `reference_field` instructions. Section and page fields remain live.
213
217
 
214
218
  `document.mdhtml(callbacks=...)` encodes MDHTML; `document.markdown()` writes canonical md. For GFM, use `document.bake(links=False).markdown(gfm=True, tmpl=...)` or the `mdhtml2gfm` convenience. `document.map_urls(callback)` returns a rewritten Document and leaves operation operands inert. Complete YAML, derived `meta`, and `warnings` remain attached.
215
219
 
216
220
  `Document.from_mdhtml(...)` and `import_mdhtml(...)` import symbolic MDHTML. Finished numbered output is not symbolic interchange input. Import normalizes a complete HTML5 fragment, not individual tag strings. Source positions and spellings remain available separately through `blocks`, `inlines`, and `rewrite`.
217
221
 
222
+ ### Citations and bibliographies
223
+
224
+ ```markdown
225
+ The method builds on [@howard2018]. [@howard2018]{ref=text} report the results. See also [see @merity2017, p. 3].
226
+
227
+ ::: bibliography
228
+ Howard and Ruder {#howard2018 year=2018}
229
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*. Proceedings of ACL.
230
+
231
+ Merity et al. {#merity2017 year=forthcoming}
232
+ : Stephen Merity et al. *Regularizing and Optimizing LSTM Language Models*.
233
+ :::
234
+ ```
235
+
236
+ The term is explicit citation-author text. `year` is an optional string, including values such as `2018a`, `n.d.` or `forthcoming`. The definition is the complete formatted entry. No author names, dates, or publication fields are inferred from prose. Bibliography generators own entry formatting, author abbreviation and date disambiguation. Definitions use the dialect's existing single-line definition syntax.
237
+
238
+ `[@howard2018]` produces `(Howard and Ruder, 2018)`. `{ref=text}` selects `Howard and Ruder (2018)`. `[-@howard2018]` suppresses the author and produces `(2018)`. Prefix and suffix text are supported per item, as in `[see @howard2018, p. 3; @merity2017]`. Ordinary cross-references also retain suffix text.
239
+
240
+ Use frontmatter `cite_style: numeric`, or `cite_style='numeric'` on an exporter, for `[1]` citations and numbered entries. Author-year is the default. Numbers follow bibliography order across the document, all entries remain included, and citation groups retain their authored order. HTML, GFM, Typst, PDF, DOCX and terminal output share the Rust preparation machinery. Exporter options override frontmatter.
241
+
242
+ Bibliography entries expose `attrs`, inline `author`, optional `year` and block `body` in `Document.blocks`. Canonical md and symbolic MDHTML retain these fields. Preparation lowers bibliography layout to ordinary blocks and citations to ordinary text and links. A prepared document no longer contains the original citation data. Change styles by preparing the original document again.
243
+
244
+ An entry requires an id and author text. A malformed bibliography, duplicate target id, unknown citation style, or invalid reference produces a conversion error. `refs='lenient'` preserves unresolved references as ids with warnings. Citation groups cannot mix bibliography entries and other targets. A narrative citation requires one work and no prefix. Citations do not support `page`, `leaf`, or `rel`.
245
+
218
246
  ### md chunks
219
247
 
220
248
  Choose among three chunking algorithms:
@@ -512,7 +540,7 @@ html = mdhtml2html(md2mdhtml(markdown), number_headings='legal')
512
540
 
513
541
  In `resolve` mode, cross-references become links with resolved text. `[@sec-pay]` becomes `<a href="#sec-pay">Section 1.</a>`. Groups use text such as "Sections 1. and 1.(a)". Figure and table references use text such as "Figure 1".
514
542
 
515
- `reftypes=dict(exh=('Exhibit', 'Exhibits'))` adds prefix words to the built-in `sec`, `fig`, `tbl`, and `eq` types. Missing targets, unknown tokens, and unknown types that need a prefix raise errors. The Word-only `page` and `rel` variants display the full number.
543
+ The built-in reference types are `sec` (Section/Sections), `fig` (Figure/Figures), `tbl` (Table/Tables), `eq` (Equation/Equations), and `exh` (Exhibit/Exhibits). Use `reftypes=dict(app=('Appendix', 'Appendices'))` to add prefix words for another type. Missing targets, unknown tokens, and unknown types that need a prefix raise errors. The Word-only `page` and `rel` variants display the full number.
516
544
 
517
545
  Two other modes support previews and drafts:
518
546
 
@@ -630,7 +658,7 @@ cat input.md | md2mdhtml --math=dollars
630
658
  from mdhtml import mdhtml2pdf, mdhtml2typst
631
659
 
632
660
  typ = mdhtml2typst(md2mdhtml(markdown), number_headings='legal')
633
- mdhtml2pdf(md2mdhtml(markdown), 'out.pdf', reftypes=dict(exh=('Exhibit', 'Exhibits')))
661
+ mdhtml2pdf(md2mdhtml(markdown), 'out.pdf')
634
662
  ```
635
663
 
636
664
  Typst resolves references at compile time. `[@sec-pay]` becomes `#ref(<sec-pay>, supplement: [Section])`. Reference numbers update when you edit and recompile the `.typ` file. This differs from exporters that resolve reference text during export.
@@ -239,7 +239,7 @@ MDHTML:
239
239
 
240
240
  Definition lists use `dl`, `dt`, and `dd`. They are a leaf block: glued term lines followed by glued single-line `: definition` lines, with inline-only definitions and no loose form (a blank line ends the run, though adjacent lists merge into one `dl`). Only `:` marks a definition line. A term line may end with an attribute block, which binds to its `dt` exactly as a trailing attribute block binds to a heading. Block content in a definition is written as raw `<dl>` soup or a fenced div. Fenced divs follow Pandoc's opening syntax: an opening fence has at least three colons and attributes, a bare class word, or — deviating from Pandoc, which allows one or the other — both, merged: `::: details {#x open=''}` and `::: {.details #x open=''}` are the same opener. The bare word means that one class. A closing fence is a colon-only line of exactly the opening fence's length, so a longer outer fence can contain a shorter colon-only line as literal text.
241
241
 
242
- A fenced div is ordinarily a `div` in MDHTML. The panel modifiers below are interpreted by the `md` importer; `math` remains a reserved class for the display-math carrier. Other class words are author styling, not implicit converter instructions.
242
+ A fenced div is ordinarily a `div` in MDHTML. The panel modifiers below and `bibliography` containers are interpreted by the `md` importer; `math` remains a reserved class for the display-math carrier. Other class words are author styling, not implicit converter instructions.
243
243
 
244
244
  ### Panels: callouts and disclosures
245
245
 
@@ -373,7 +373,7 @@ See [@sec-payment], [-@tbl-stages], [Clause @sec-late], and
373
373
  <span data-refs=""><a href="#sec-payment" data-ref=""></a><a href="#sec-late" data-ref=""></a></span>. Page <a href="#sec-late" data-ref="bare page"></a>.</p>
374
374
  ```
375
375
 
376
- References are recognized only inside bracket groups. An id starts with an ASCII letter or digit and continues with ASCII letters, digits, `-`, or `_`. Prefix text requires whitespace before `@` and is allowed only on a lone reference. A reference-only group may contain semicolon-separated references. Explicit link syntax wins, and a group that fails this grammar remains literal text. Thus `[@sec-x](url)` is a link and `[user@host]` is ordinary text.
376
+ References are recognized only inside bracket groups. An id starts with an ASCII letter or digit and continues with ASCII letters, digits, `-`, or `_`. Each semicolon-separated item may carry prefix text before `@`, separated by whitespace, and suffix text after its id. A cross-reference prefix overrides its automatic prefix word. The suffix follows the resolved reference verbatim and is encoded as `data-suffix` on the anchor. Explicit link syntax wins. A group that fails this grammar remains literal text. Thus `[@sec-x](url)` is a link and `[user@host]` is ordinary text.
377
377
 
378
378
  The presence of `data-ref` marks a reference. No token selects the default full rendering. `bare` independently suppresses the prefix word, and at most one of `page`, `text`, `leaf`, or `rel` selects another rendering. Token order is insignificant. Bare `data-ref` and `data-ref=""` are the same DOM value; html5ever serializes it as `data-ref=""`. Unknown or conflicting tokens are MDHTML errors and converters report them as conversion errors. A group uses `data-refs` on its containing `span`.
379
379
 
@@ -387,6 +387,37 @@ The shipped exporters use Rust's shared reference vocabulary through `mdhtml.exp
387
387
 
388
388
  `mdhtml2html` also offers `refs='ids'` for live-preview contexts where targets may sit outside the fragment: each reference bakes as a working link showing its target id (class `xref`), with no registry, numbering, or failure modes - and captions render as authored, since per-fragment numbers would lie. `id_prefix` namespaces the fragment's ids against a host page (the authored id kept in `data-id`), and `fn_salt` adds a further prefix to the `fn-*`/`fnref-*` footnote namespace only, keeping footnote pairs distinct across fragments that share one `id_prefix`.
389
389
 
390
+ ## Citations and bibliographies
391
+
392
+ A fenced `bibliography` div contains one definition list, with one term per entry:
393
+
394
+ ```markdown
395
+ ::: bibliography
396
+ Howard and Ruder {#howard2018 year=2018}
397
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*.
398
+ :::
399
+ ```
400
+
401
+ The term supplies citation-author text, its id supplies the key, and `year` supplies optional citation-date text. The date is an uninterpreted nonempty string. The definition supplies the complete formatted entry using the ordinary definition-list syntax. Author abbreviation, date disambiguation, publication formatting, and bibliography generation belong to the producer. mdhtml never recovers bibliographic fields from prose. Missing ids, empty author text, malformed bibliography structure and duplicate target ids are conversion errors.
402
+
403
+ Symbolic MDHTML uses `<div class="bibliography"><dl><dt id="howard2018" year="2018">Howard and Ruder</dt><dd>...</dd></dl></div>`. The semantic `Bibliography` block retains entries with attributes, inline author text, optional year, and block body. The class `bibliography` is reserved for this structure. Finished output uses ordinary blocks with the styling class `bibliography-entries`.
404
+
405
+ A reference to a bibliography entry is a citation. It shares the reference parser, target index, validation and link machinery with other references. The default style is `author-year`. Frontmatter `cite_style: numeric` or an exporter's `cite_style` argument selects numeric style. An explicit argument overrides frontmatter. Unknown styles are errors in all exporters.
406
+
407
+ | Source | Author-year | Numeric |
408
+ |:--|:--|:--|
409
+ | `[@howard2018]` | (Howard and Ruder, 2018) | [1] |
410
+ | `[@howard2018]{ref=text}` | Howard and Ruder (2018) | Howard and Ruder [1] |
411
+ | `[-@howard2018]` | (2018) | [1] |
412
+ | `[-@howard2018]{ref=text}` | 2018 | [1] |
413
+ | `[see @howard2018, p. 3]` | (see Howard and Ruder, 2018, p. 3) | see [1, p. 3] |
414
+
415
+ With no year, author-year citations use the author text alone; `bare` does not remove it. Parenthetical groups share one pair of delimiters and preserve authored item order. Author-year groups use `; `. Numeric groups use `, ` when every suffix is empty, otherwise `; `. In numeric style the first item's prefix precedes the brackets; other prefixes precede their items. A suffix retains its authored punctuation. `text` requires one citation and no prefix. `page`, `leaf`, and `rel` are invalid for citations. A group cannot mix citations and other reference kinds. An unknown key alongside a known citation retains citation grouping in lenient mode and produces a warning.
416
+
417
+ All bibliography entries appear in authored order, including uncited entries. Numeric style numbers them in that order across all bibliographies in the document. Author-year output renders each formatted body without its citation-author term. Numeric output prefixes each body with its number. Formats supporting internal links link citations to their entries; GFM and terminal output use plain citation text.
418
+
419
+ Rust preparation assigns numbers, lowers bibliography layout to ordinary blocks, and resolves citations to ordinary inline content. It returns the prepared document and reference index. Remaining cross-references stay symbolic; the shared reference plan contains ordinary inline content and native-field instructions. Typst and DOCX emit native fields for these remaining references. Static baking resolves them as well. Preparation does not mutate the original document. Reformat the original document when changing citation style.
420
+
390
421
  ## Raw HTML and md in HTML
391
422
 
392
423
  Raw HTML participates in the final whole-fragment HTML5 parse. There is no separate balance operation.
@@ -591,7 +622,7 @@ Beyond the element mapping above, a few structural patterns carry a *meaning* ev
591
622
  - **Range markers.** Template `section`/`inverted` and `end` operations are paired siblings around the content they control. Converters render unfilled range instructions visibly when appropriate; the content between markers remains normal flow content.
592
623
  - **Active-code carriers.** A `text/<lang>-block` script is template code, not content: dropped from final documents by default, echoable as code where an audit register wants it, and never executed by any converter (`instantiate` alone executes).
593
624
 
594
- The class words with assigned converter behavior — `math` for math carriers and `footnotes` on the footnote `section` — are reserved by this section. `details` and `callout-*` are authoring aliases normalized to panels by the `md` importer, not class-based export rules. Other class words are inert data for styling.
625
+ The class words with assigned converter behavior — `math` for math carriers, `footnotes` on the footnote `section`, and `bibliography` on a bibliography container — are reserved by this section. `details` and `callout-*` are authoring aliases normalized to panels by the `md` importer, not class-based export rules. Other class words are inert data for styling.
595
626
 
596
627
  ## Warnings
597
628
 
@@ -321,6 +321,27 @@ page [-@sec-late]{ref=page}, paragraph [-@sec-late]{ref=leaf} of
321
321
  <h3 id="sec-payment">Payment terms</h3>
322
322
  <h4 id="sec-late">Late fees</h4>
323
323
  <p>Interest accrues per <a href="#sec-late" data-ref=""></a>, within <a href="#sec-payment" data-ref="bare"></a>, as set out in <a href="#sec-late" data-ref="">Clause</a>. The terms in <span data-refs=""><a href="#sec-payment" data-ref=""></a><a href="#sec-late" data-ref=""></a></span> survive termination. See also <a href="#fig-diagram" data-ref=""></a> and <a href="#tbl-stages" data-ref="bare"></a>, or the mixed pair <span data-refs=""><a href="#fig-diagram" data-ref=""></a><a href="#tbl-stages" data-ref=""></a></span>. Variants: the <a href="#sec-late" data-ref="bare text"></a> clause, on page <a href="#sec-late" data-ref="bare page"></a>, paragraph <a href="#sec-late" data-ref="bare leaf"></a> of <a href="#sec-late" data-ref="bare rel"></a>.</p>
324
+ <h2>Citations and bibliographies</h2>
325
+ <p>Bibliography terms contain explicit citation-author text, keys and optional year text. Their definitions are formatted entries. Use <code>cite_style: numeric</code> in frontmatter for numbered citations in bibliography order.</p>
326
+ <pre><code class="language-markdown">The method builds on [@howard2018]. [@howard2018]{ref=text} report the results. See [see @merity2017, p. 3], or suppress the author with [-@howard2018].
327
+
328
+ ::: bibliography
329
+ Howard and Ruder {#howard2018 year=2018}
330
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*. Proceedings of ACL.
331
+
332
+ Merity et al. {#merity2017 year=forthcoming}
333
+ : Stephen Merity et al. *Regularizing and Optimizing LSTM Language Models*.
334
+ :::
335
+ </code></pre>
336
+ <p>The method builds on <a href="#howard2018" data-ref=""></a>. <a href="#howard2018" data-ref="text"></a> report the results. See <a href="#merity2017" data-ref="" data-suffix=", p. 3">see</a>, or suppress the author with <a href="#howard2018" data-ref="bare"></a>.</p>
337
+ <div class="bibliography">
338
+ <dl>
339
+ <dt id="howard2018" year="2018">Howard and Ruder</dt>
340
+ <dd>Jeremy Howard and Sebastian Ruder. 2018. <em>Universal Language Model Fine-tuning for Text Classification</em>. Proceedings of ACL.</dd>
341
+ <dt id="merity2017" year="forthcoming">Merity et al.</dt>
342
+ <dd>Stephen Merity et al. <em>Regularizing and Optimizing LSTM Language Models</em>.</dd>
343
+ </dl>
344
+ </div>
324
345
  <h2>Raw passthrough</h2>
325
346
  <p>A fenced block whose info string is <code>{=name}</code>, or inline code followed by <code>{=name}</code>, passes through for the converter that understands that format; everyone else drops it:</p>
326
347
  <pre><code class="language-markdown">```{=docx}
@@ -255,6 +255,20 @@ See also [@fig-diagram] and [-@tbl-stages], or the mixed pair
255
255
  page [-@sec-late]{ref=page}, paragraph [-@sec-late]{ref=leaf} of
256
256
  [-@sec-late]{ref=rel}.
257
257
 
258
+ ## Citations and bibliographies
259
+
260
+ Bibliography terms contain explicit citation-author text, keys and optional year text. Their definitions are formatted entries. Use `cite_style: numeric` in frontmatter for numbered citations in bibliography order.
261
+
262
+ The method builds on [@howard2018]. [@howard2018]{ref=text} report the results. See [see @merity2017, p. 3], or suppress the author with [-@howard2018].
263
+
264
+ ::: bibliography
265
+ Howard and Ruder {#howard2018 year=2018}
266
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*. Proceedings of ACL.
267
+
268
+ Merity et al. {#merity2017 year=forthcoming}
269
+ : Stephen Merity et al. *Regularizing and Optimizing LSTM Language Models*.
270
+ :::
271
+
258
272
  ## Raw passthrough
259
273
 
260
274
  A fenced block whose info string is `{=name}`, or inline code followed by
@@ -466,6 +466,32 @@ See also [@fig-diagram] and [-@tbl-stages], or the mixed pair
466
466
  page [-@sec-late]{ref=page}, paragraph [-@sec-late]{ref=leaf} of
467
467
  [-@sec-late]{ref=rel}.
468
468
 
469
+ ## Citations and bibliographies
470
+
471
+ Bibliography terms contain explicit citation-author text, keys and optional year text. Their definitions are formatted entries. Use `cite_style: numeric` in frontmatter for numbered citations in bibliography order.
472
+
473
+ `````markdown
474
+ The method builds on [@howard2018]. [@howard2018]{ref=text} report the results. See [see @merity2017, p. 3], or suppress the author with [-@howard2018].
475
+
476
+ ::: bibliography
477
+ Howard and Ruder {#howard2018 year=2018}
478
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*. Proceedings of ACL.
479
+
480
+ Merity et al. {#merity2017 year=forthcoming}
481
+ : Stephen Merity et al. *Regularizing and Optimizing LSTM Language Models*.
482
+ :::
483
+ `````
484
+
485
+ The method builds on [@howard2018]. [@howard2018]{ref=text} report the results. See [see @merity2017, p. 3], or suppress the author with [-@howard2018].
486
+
487
+ ::: bibliography
488
+ Howard and Ruder {#howard2018 year=2018}
489
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*. Proceedings of ACL.
490
+
491
+ Merity et al. {#merity2017 year=forthcoming}
492
+ : Stephen Merity et al. *Regularizing and Optimizing LSTM Language Models*.
493
+ :::
494
+
469
495
  ## Raw passthrough
470
496
 
471
497
  A fenced block whose info string is `{=name}`, or inline code followed by
@@ -297,6 +297,22 @@ page [-@sec-late]{ref=page}, paragraph [-@sec-late]{ref=leaf} of
297
297
  [-@sec-late]{ref=rel}.
298
298
  `````
299
299
 
300
+ ## Citations and bibliographies
301
+
302
+ Bibliography terms contain explicit citation-author text, keys and optional year text. Their definitions are formatted entries. Use `cite_style: numeric` in frontmatter for numbered citations in bibliography order.
303
+
304
+ `````markdown
305
+ The method builds on [@howard2018]. [@howard2018]{ref=text} report the results. See [see @merity2017, p. 3], or suppress the author with [-@howard2018].
306
+
307
+ ::: bibliography
308
+ Howard and Ruder {#howard2018 year=2018}
309
+ : Jeremy Howard and Sebastian Ruder. 2018. *Universal Language Model Fine-tuning for Text Classification*. Proceedings of ACL.
310
+
311
+ Merity et al. {#merity2017 year=forthcoming}
312
+ : Stephen Merity et al. *Regularizing and Optimizing LSTM Language Models*.
313
+ :::
314
+ `````
315
+
300
316
  ## Raw passthrough
301
317
 
302
318
  A fenced block whose info string is `{=name}`, or inline code followed by