scholarly-parse 0.1.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 (238) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +201 -0
  3. package/README.md +118 -0
  4. package/changelog/0.1.x/0.1.0.md +17 -0
  5. package/changelog/template.md +150 -0
  6. package/dist/detect.d.ts +11 -0
  7. package/dist/detect.d.ts.map +1 -0
  8. package/dist/detect.js +51 -0
  9. package/dist/detect.js.map +1 -0
  10. package/dist/formats/html/blocks.d.ts +29 -0
  11. package/dist/formats/html/blocks.d.ts.map +1 -0
  12. package/dist/formats/html/blocks.js +527 -0
  13. package/dist/formats/html/blocks.js.map +1 -0
  14. package/dist/formats/html/context.d.ts +19 -0
  15. package/dist/formats/html/context.d.ts.map +1 -0
  16. package/dist/formats/html/context.js +122 -0
  17. package/dist/formats/html/context.js.map +1 -0
  18. package/dist/formats/html/index.d.ts +7 -0
  19. package/dist/formats/html/index.d.ts.map +1 -0
  20. package/dist/formats/html/index.js +7 -0
  21. package/dist/formats/html/index.js.map +1 -0
  22. package/dist/formats/html/inline.d.ts +26 -0
  23. package/dist/formats/html/inline.d.ts.map +1 -0
  24. package/dist/formats/html/inline.js +253 -0
  25. package/dist/formats/html/inline.js.map +1 -0
  26. package/dist/formats/html/metadata.d.ts +30 -0
  27. package/dist/formats/html/metadata.d.ts.map +1 -0
  28. package/dist/formats/html/metadata.js +212 -0
  29. package/dist/formats/html/metadata.js.map +1 -0
  30. package/dist/formats/html/parse.d.ts +17 -0
  31. package/dist/formats/html/parse.d.ts.map +1 -0
  32. package/dist/formats/html/parse.js +405 -0
  33. package/dist/formats/html/parse.js.map +1 -0
  34. package/dist/formats/html/references.d.ts +12 -0
  35. package/dist/formats/html/references.d.ts.map +1 -0
  36. package/dist/formats/html/references.js +123 -0
  37. package/dist/formats/html/references.js.map +1 -0
  38. package/dist/formats/jats/blocks.d.ts +52 -0
  39. package/dist/formats/jats/blocks.d.ts.map +1 -0
  40. package/dist/formats/jats/blocks.js +614 -0
  41. package/dist/formats/jats/blocks.js.map +1 -0
  42. package/dist/formats/jats/context.d.ts +17 -0
  43. package/dist/formats/jats/context.d.ts.map +1 -0
  44. package/dist/formats/jats/context.js +2 -0
  45. package/dist/formats/jats/context.js.map +1 -0
  46. package/dist/formats/jats/fragment.d.ts +7 -0
  47. package/dist/formats/jats/fragment.d.ts.map +1 -0
  48. package/dist/formats/jats/fragment.js +42 -0
  49. package/dist/formats/jats/fragment.js.map +1 -0
  50. package/dist/formats/jats/front.d.ts +25 -0
  51. package/dist/formats/jats/front.d.ts.map +1 -0
  52. package/dist/formats/jats/front.js +380 -0
  53. package/dist/formats/jats/front.js.map +1 -0
  54. package/dist/formats/jats/index.d.ts +8 -0
  55. package/dist/formats/jats/index.d.ts.map +1 -0
  56. package/dist/formats/jats/index.js +8 -0
  57. package/dist/formats/jats/index.js.map +1 -0
  58. package/dist/formats/jats/inline.d.ts +24 -0
  59. package/dist/formats/jats/inline.d.ts.map +1 -0
  60. package/dist/formats/jats/inline.js +274 -0
  61. package/dist/formats/jats/inline.js.map +1 -0
  62. package/dist/formats/jats/parse.d.ts +9 -0
  63. package/dist/formats/jats/parse.d.ts.map +1 -0
  64. package/dist/formats/jats/parse.js +247 -0
  65. package/dist/formats/jats/parse.js.map +1 -0
  66. package/dist/formats/jats/references.d.ts +25 -0
  67. package/dist/formats/jats/references.d.ts.map +1 -0
  68. package/dist/formats/jats/references.js +406 -0
  69. package/dist/formats/jats/references.js.map +1 -0
  70. package/dist/formats/jats/tables.d.ts +18 -0
  71. package/dist/formats/jats/tables.d.ts.map +1 -0
  72. package/dist/formats/jats/tables.js +105 -0
  73. package/dist/formats/jats/tables.js.map +1 -0
  74. package/dist/formats/jats/text.d.ts +23 -0
  75. package/dist/formats/jats/text.d.ts.map +1 -0
  76. package/dist/formats/jats/text.js +114 -0
  77. package/dist/formats/jats/text.js.map +1 -0
  78. package/dist/formats/latexml/blocks.d.ts +13 -0
  79. package/dist/formats/latexml/blocks.d.ts.map +1 -0
  80. package/dist/formats/latexml/blocks.js +454 -0
  81. package/dist/formats/latexml/blocks.js.map +1 -0
  82. package/dist/formats/latexml/context.d.ts +19 -0
  83. package/dist/formats/latexml/context.d.ts.map +1 -0
  84. package/dist/formats/latexml/context.js +18 -0
  85. package/dist/formats/latexml/context.js.map +1 -0
  86. package/dist/formats/latexml/index.d.ts +7 -0
  87. package/dist/formats/latexml/index.d.ts.map +1 -0
  88. package/dist/formats/latexml/index.js +7 -0
  89. package/dist/formats/latexml/index.js.map +1 -0
  90. package/dist/formats/latexml/inline.d.ts +16 -0
  91. package/dist/formats/latexml/inline.d.ts.map +1 -0
  92. package/dist/formats/latexml/inline.js +113 -0
  93. package/dist/formats/latexml/inline.js.map +1 -0
  94. package/dist/formats/latexml/parse.d.ts +16 -0
  95. package/dist/formats/latexml/parse.d.ts.map +1 -0
  96. package/dist/formats/latexml/parse.js +405 -0
  97. package/dist/formats/latexml/parse.js.map +1 -0
  98. package/dist/formats/pdf/blocks.d.ts +14 -0
  99. package/dist/formats/pdf/blocks.d.ts.map +1 -0
  100. package/dist/formats/pdf/blocks.js +203 -0
  101. package/dist/formats/pdf/blocks.js.map +1 -0
  102. package/dist/formats/pdf/index.d.ts +7 -0
  103. package/dist/formats/pdf/index.d.ts.map +1 -0
  104. package/dist/formats/pdf/index.js +7 -0
  105. package/dist/formats/pdf/index.js.map +1 -0
  106. package/dist/formats/pdf/inline.d.ts +8 -0
  107. package/dist/formats/pdf/inline.d.ts.map +1 -0
  108. package/dist/formats/pdf/inline.js +91 -0
  109. package/dist/formats/pdf/inline.js.map +1 -0
  110. package/dist/formats/pdf/layout.d.ts +33 -0
  111. package/dist/formats/pdf/layout.d.ts.map +1 -0
  112. package/dist/formats/pdf/layout.js +358 -0
  113. package/dist/formats/pdf/layout.js.map +1 -0
  114. package/dist/formats/pdf/lines.d.ts +40 -0
  115. package/dist/formats/pdf/lines.d.ts.map +1 -0
  116. package/dist/formats/pdf/lines.js +104 -0
  117. package/dist/formats/pdf/lines.js.map +1 -0
  118. package/dist/formats/pdf/load.d.ts +43 -0
  119. package/dist/formats/pdf/load.d.ts.map +1 -0
  120. package/dist/formats/pdf/load.js +126 -0
  121. package/dist/formats/pdf/load.js.map +1 -0
  122. package/dist/formats/pdf/parse.d.ts +9 -0
  123. package/dist/formats/pdf/parse.d.ts.map +1 -0
  124. package/dist/formats/pdf/parse.js +126 -0
  125. package/dist/formats/pdf/parse.js.map +1 -0
  126. package/dist/formats/pdf/references.d.ts +14 -0
  127. package/dist/formats/pdf/references.d.ts.map +1 -0
  128. package/dist/formats/pdf/references.js +104 -0
  129. package/dist/formats/pdf/references.js.map +1 -0
  130. package/dist/formats/pdf/structure.d.ts +29 -0
  131. package/dist/formats/pdf/structure.d.ts.map +1 -0
  132. package/dist/formats/pdf/structure.js +533 -0
  133. package/dist/formats/pdf/structure.js.map +1 -0
  134. package/dist/formats/tei/index.d.ts +7 -0
  135. package/dist/formats/tei/index.d.ts.map +1 -0
  136. package/dist/formats/tei/index.js +7 -0
  137. package/dist/formats/tei/index.js.map +1 -0
  138. package/dist/formats/tei/inline.d.ts +24 -0
  139. package/dist/formats/tei/inline.d.ts.map +1 -0
  140. package/dist/formats/tei/inline.js +107 -0
  141. package/dist/formats/tei/inline.js.map +1 -0
  142. package/dist/formats/tei/parse.d.ts +4 -0
  143. package/dist/formats/tei/parse.d.ts.map +1 -0
  144. package/dist/formats/tei/parse.js +560 -0
  145. package/dist/formats/tei/parse.js.map +1 -0
  146. package/dist/html/dom.d.ts +35 -0
  147. package/dist/html/dom.d.ts.map +1 -0
  148. package/dist/html/dom.js +70 -0
  149. package/dist/html/dom.js.map +1 -0
  150. package/dist/html/interstitial.d.ts +14 -0
  151. package/dist/html/interstitial.d.ts.map +1 -0
  152. package/dist/html/interstitial.js +67 -0
  153. package/dist/html/interstitial.js.map +1 -0
  154. package/dist/html/tables.d.ts +12 -0
  155. package/dist/html/tables.d.ts.map +1 -0
  156. package/dist/html/tables.js +62 -0
  157. package/dist/html/tables.js.map +1 -0
  158. package/dist/index.d.ts +12 -0
  159. package/dist/index.d.ts.map +1 -0
  160. package/dist/index.js +12 -0
  161. package/dist/index.js.map +1 -0
  162. package/dist/model/diagnostics.d.ts +15 -0
  163. package/dist/model/diagnostics.d.ts.map +1 -0
  164. package/dist/model/diagnostics.js +37 -0
  165. package/dist/model/diagnostics.js.map +1 -0
  166. package/dist/model/document.d.ts +289 -0
  167. package/dist/model/document.d.ts.map +1 -0
  168. package/dist/model/document.js +13 -0
  169. package/dist/model/document.js.map +1 -0
  170. package/dist/model/extremes.d.ts +11 -0
  171. package/dist/model/extremes.d.ts.map +1 -0
  172. package/dist/model/extremes.js +23 -0
  173. package/dist/model/extremes.js.map +1 -0
  174. package/dist/model/index.d.ts +8 -0
  175. package/dist/model/index.d.ts.map +1 -0
  176. package/dist/model/index.js +2 -0
  177. package/dist/model/index.js.map +1 -0
  178. package/dist/model/input.d.ts +14 -0
  179. package/dist/model/input.d.ts.map +1 -0
  180. package/dist/model/input.js +47 -0
  181. package/dist/model/input.js.map +1 -0
  182. package/dist/model/result.d.ts +53 -0
  183. package/dist/model/result.d.ts.map +1 -0
  184. package/dist/model/result.js +40 -0
  185. package/dist/model/result.js.map +1 -0
  186. package/dist/model/section-ids.d.ts +8 -0
  187. package/dist/model/section-ids.d.ts.map +1 -0
  188. package/dist/model/section-ids.js +28 -0
  189. package/dist/model/section-ids.js.map +1 -0
  190. package/dist/model/section-kinds.d.ts +19 -0
  191. package/dist/model/section-kinds.d.ts.map +1 -0
  192. package/dist/model/section-kinds.js +42 -0
  193. package/dist/model/section-kinds.js.map +1 -0
  194. package/dist/model/table-grid.d.ts +40 -0
  195. package/dist/model/table-grid.d.ts.map +1 -0
  196. package/dist/model/table-grid.js +79 -0
  197. package/dist/model/table-grid.js.map +1 -0
  198. package/dist/parse.d.ts +18 -0
  199. package/dist/parse.d.ts.map +1 -0
  200. package/dist/parse.js +35 -0
  201. package/dist/parse.js.map +1 -0
  202. package/dist/render/escape.d.ts +53 -0
  203. package/dist/render/escape.d.ts.map +1 -0
  204. package/dist/render/escape.js +94 -0
  205. package/dist/render/escape.js.map +1 -0
  206. package/dist/render/index.d.ts +8 -0
  207. package/dist/render/index.d.ts.map +1 -0
  208. package/dist/render/index.js +8 -0
  209. package/dist/render/index.js.map +1 -0
  210. package/dist/render/inline.d.ts +39 -0
  211. package/dist/render/inline.d.ts.map +1 -0
  212. package/dist/render/inline.js +87 -0
  213. package/dist/render/inline.js.map +1 -0
  214. package/dist/render/markdown.d.ts +35 -0
  215. package/dist/render/markdown.d.ts.map +1 -0
  216. package/dist/render/markdown.js +279 -0
  217. package/dist/render/markdown.js.map +1 -0
  218. package/dist/render/sections.d.ts +25 -0
  219. package/dist/render/sections.d.ts.map +1 -0
  220. package/dist/render/sections.js +45 -0
  221. package/dist/render/sections.js.map +1 -0
  222. package/dist/render/text.d.ts +13 -0
  223. package/dist/render/text.d.ts.map +1 -0
  224. package/dist/render/text.js +66 -0
  225. package/dist/render/text.js.map +1 -0
  226. package/dist/xml/mathml.d.ts +24 -0
  227. package/dist/xml/mathml.d.ts.map +1 -0
  228. package/dist/xml/mathml.js +201 -0
  229. package/dist/xml/mathml.js.map +1 -0
  230. package/dist/xml/ordered.d.ts +49 -0
  231. package/dist/xml/ordered.d.ts.map +1 -0
  232. package/dist/xml/ordered.js +151 -0
  233. package/dist/xml/ordered.js.map +1 -0
  234. package/dist/xml/well-formed.d.ts +15 -0
  235. package/dist/xml/well-formed.d.ts.map +1 -0
  236. package/dist/xml/well-formed.js +120 -0
  237. package/dist/xml/well-formed.js.map +1 -0
  238. package/package.json +137 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project. Each entry links to its full per-version file in [changelog/](changelog/).
4
+
5
+ ## [0.1.0](changelog/0.1.x/0.1.0.md) — 2026-09-26
6
+
7
+ First release: JATS, Grobid TEI, arXiv LaTeXML, publisher HTML, and PDF parsed into one document model and rendered as Markdown.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ <div align="center">
2
+ <h1>scholarly-parse</h1>
3
+ <p><b>Parse scholarly papers — JATS, Grobid TEI, arXiv HTML, publisher HTML, PDF — into one document model and Markdown.</b></p>
4
+ </div>
5
+
6
+ <div align="center">
7
+
8
+ [![Version](https://img.shields.io/badge/Version-0.1.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Node](https://img.shields.io/badge/Node-%E2%89%A522-339933.svg?style=flat-square&logo=nodedotjs&logoColor=white)](https://nodejs.org/)
9
+
10
+ </div>
11
+
12
+ ---
13
+
14
+ ## What it does
15
+
16
+ `scholarly-parse` reads a paper in any of five formats — JATS XML from PubMed Central, Europe PMC, and publisher feeds; TEI from Grobid; LaTeXML HTML from arXiv; publisher article pages; and PDF — into one `ScholarlyDocument`, and renders it as Markdown. It parses only: fetching, rate limiting, and licensing decisions stay with the caller.
17
+
18
+ ## Install
19
+
20
+ ```sh
21
+ bun add scholarly-parse
22
+ # or
23
+ npm install scholarly-parse
24
+ ```
25
+
26
+ The JATS and TEI parsers need nothing more. The others load an optional peer on first use, and throw with the install command when it is missing:
27
+
28
+ | Format | Also install |
29
+ |:---|:---|
30
+ | `scholarly-parse/latexml`, `scholarly-parse/html` | `linkedom` |
31
+ | `scholarly-parse/pdf` | `unpdf` |
32
+
33
+ Runs on Bun, Node ≥22, and Cloudflare Workers. ESM only.
34
+
35
+ ## Usage
36
+
37
+ ```ts
38
+ import { toMarkdown } from 'scholarly-parse';
39
+ import { parseJats } from 'scholarly-parse/jats';
40
+
41
+ const result = parseJats(xml);
42
+ if (result.ok) console.log(toMarkdown(result.document));
43
+ else console.error(result.error.reason, result.error.message);
44
+ ```
45
+
46
+ When the format isn't known, `parse` detects it from the payload and loads that parser. It is async, since the HTML and PDF parsers are:
47
+
48
+ ```ts
49
+ import { parse } from 'scholarly-parse';
50
+
51
+ const result = await parse(bytes, { baseUrl: url });
52
+ if (!result.ok && result.error.reason === 'blocked') {
53
+ // a captcha or access-denied page arrived instead of the paper
54
+ }
55
+ ```
56
+
57
+ `toSections` flattens the document into sections with their heading paths and sizes, for serving a long paper a piece at a time:
58
+
59
+ ```ts
60
+ import { toSections } from 'scholarly-parse';
61
+
62
+ for (const { path, chars, markdown } of toSections(document)) {
63
+ console.log(path.join(' › '), chars);
64
+ }
65
+ ```
66
+
67
+ ## API
68
+
69
+ | Import | Exports |
70
+ |:---|:---|
71
+ | `scholarly-parse` | `detect`, `parse`, `toMarkdown`, `toText`, `toSections`, and the model types |
72
+ | `scholarly-parse/jats` | `parseJats`, `jatsInlineToMarkdown` |
73
+ | `scholarly-parse/tei` | `parseTei` |
74
+ | `scholarly-parse/latexml` | `parseLatexml` |
75
+ | `scholarly-parse/html` | `parseHtml` |
76
+ | `scholarly-parse/pdf` | `parsePdf` |
77
+
78
+ Every parser returns `{ ok: true, document }` or `{ ok: false, error: { reason, message } }`, where `reason` is `malformed`, `wrong-format`, `empty`, `blocked`, or `too-large`. Each takes a `maxInputBytes` budget; `parseLatexml` and `parseHtml` take the page's `baseUrl` to resolve links, and `parsePdf` a `maxPages` limit (default 300). `parseJats` and `parseTei` are synchronous; the rest are async.
79
+
80
+ ## Formats
81
+
82
+ | Subpath | Reads | Quality |
83
+ |:---|:---|:---|
84
+ | `/jats` | JATS 1.x as PubMed Central, Europe PMC, bioRxiv, and publisher feeds serve it | `structured` |
85
+ | `/tei` | Grobid TEI, including the HTML-wrapped form OpenAlex serves | `structured` |
86
+ | `/latexml` | arXiv HTML and ar5iv renders | `structured` |
87
+ | `/html` | Publisher and preprint-server article pages | `partial` |
88
+ | `/pdf` | PDFs with a text layer, structure read from typography | `partial`, or `flat` when no headings are found |
89
+
90
+ ## Document model
91
+
92
+ A `ScholarlyDocument` holds `metadata` (title, authors, venue, identifiers, license, and related works such as the article a correction corrects or the notice retracting it), `abstracts` by kind, `body` and `back` section trees of typed blocks (paragraph, list, table, figure, formula, code, quote, box, supplement), `floats`, `references`, `footnotes`, and `diagnostics`: the `quality` level, coded warnings, and source elements no handler covered. [`docs/design.md`](./docs/design.md) outlines it and records the decisions behind it; [`src/model/document.ts`](./src/model/document.ts) is the source of truth.
93
+
94
+ ## Project structure
95
+
96
+ | Path | Purpose |
97
+ |:---|:---|
98
+ | `src/model/` | The document model and the `ParseResult` type |
99
+ | `src/formats/` | One parser per format |
100
+ | `src/detect.ts`, `src/parse.ts` | Format detection, and `parse` for any format |
101
+ | `src/render/` | Markdown, plain text, section list |
102
+ | `src/html/`, `src/xml/` | The shared DOM and XML readers, HTML tables, MathML to TeX |
103
+ | `corpus/` | Openly licensed real documents the parsers are tested against |
104
+ | `tests/` | Unit tests and the corpus suite |
105
+ | `docs/design.md` | Scope, API, model, and decisions |
106
+
107
+ ## Development
108
+
109
+ ```sh
110
+ bun install
111
+ bun run devcheck
112
+ ```
113
+
114
+ Rules for working in the repo are in [`CLAUDE.md`](./CLAUDE.md). Bugs and requests go through [issues](https://github.com/cyanheads/scholarly-parse/issues) — see [CONTRIBUTING](./.github/CONTRIBUTING.md).
115
+
116
+ ## License
117
+
118
+ [Apache-2.0](./LICENSE). Corpus documents keep their own licenses — see [`corpus/ATTRIBUTION.md`](./corpus/ATTRIBUTION.md).
@@ -0,0 +1,17 @@
1
+ ---
2
+ summary: "First release: JATS, Grobid TEI, arXiv LaTeXML, publisher HTML, and PDF parsed into one document model and rendered as Markdown."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.1.0 — 2026-09-26
8
+
9
+ ## Added
10
+
11
+ - **Format parsers, one subpath each** — `parseJats` (`scholarly-parse/jats`), `parseTei` (`/tei`, Grobid TEI including OpenAlex's HTML-wrapped form), `parseLatexml` (`/latexml`, arXiv HTML and ar5iv), `parseHtml` (`/html`, publisher article pages), and `parsePdf` (`/pdf`, PDFs with a text layer). The XML parsers are synchronous; HTML and PDF are async and need the optional peers `linkedom` and `unpdf`.
12
+ - **`detect`** names a payload's format from its opening bytes; **`parse`** runs that format's parser, loaded on first use.
13
+ - **`ScholarlyDocument`** — the model every parser produces: front matter (including related works, such as the article a correction corrects or the notice retracting it), abstracts by kind, a section tree of typed blocks (paragraph, list, table, figure, formula, code, quote, box, supplement), references, footnotes, floats, and `diagnostics` with a `quality` of `structured`, `partial`, or `flat`, coded warnings, and unhandled source elements.
14
+ - **`ParseResult`** — parsers return `{ ok: true, document }` or `{ ok: false, error: { reason, message } }`, with reasons `malformed`, `wrong-format`, `empty`, `blocked` (a captcha or access-denied page served in the paper's place), and `too-large` (over `maxInputBytes`). A document that breaks a parser in a way it did not anticipate still comes back `malformed`; only a missing optional peer throws.
15
+ - **`toMarkdown`**, **`toText`**, **`toSections`** — Markdown with `MarkdownOptions` to choose abstracts, back matter, footnotes, references, or specific sections; plain text; and a flat section list with paths and sizes for paging a long paper. Source text is escaped so it cannot become live HTML, a script link, or Markdown structure it never was.
16
+ - **`jatsInlineToMarkdown`** converts a JATS fragment, such as a Crossref or Europe PMC abstract, without an article around it.
17
+ - **Corpus** — 71 openly licensed documents (38 JATS, 11 LaTeXML, 8 TEI, 8 PDF, 6 publisher HTML) run through their parsers on every test, each held to the corpus invariants, assertions of its own, and a reviewed Markdown snapshot.
@@ -0,0 +1,150 @@
1
+ ---
2
+ # FORMAT REFERENCE — do not edit. Copy this file to
3
+ # `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
4
+ # to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
5
+ # with a concrete date.
6
+
7
+ # Required. One-line GitHub Release-style headline. 350 character cap — a
8
+ # ceiling, not a target. Default short and scannable. Don't pad, don't stitch
9
+ # unrelated changes with commas/semicolons into an inventory — pick the one
10
+ # headline the release is about. Quotes required: unquoted YAML treats
11
+ # `: ` inside the value as a key separator and fails GitHub's strict parser.
12
+ summary: ""
13
+
14
+ # Set `true` when consumers must change code to upgrade: API removals,
15
+ # signature changes, config renames, behavior changes that break existing
16
+ # usage. Flagged as `Breaking` in the rollup.
17
+ breaking: false
18
+
19
+ # Set `true` ONLY for a security fix in THIS project's own source code — a
20
+ # vulnerability or hardening in code you ship. A dependency or transitive CVE
21
+ # bump is routine maintenance, NOT a security release: record it under
22
+ # `## Dependencies` (with the advisory ID) and leave this `false`. When true,
23
+ # pairs with the `## Security` section below and flags `Security` in the rollup.
24
+ security: false
25
+
26
+ # Optional free-form notes for agents upgrading a project that depends on
27
+ # scholarly-parse. Not rendered in CHANGELOG. ADOPTION STEPS ONLY — renamed
28
+ # fields to follow, call sites to change, one-time migration steps. Never a
29
+ # second rendering of the body: if a body bullet already says it, name the
30
+ # bullet's symbol instead of re-explaining. Omit the field entirely when
31
+ # there's nothing to say.
32
+ # agent-notes: |
33
+ # <instructions for agents upgrading a consumer>
34
+ ---
35
+
36
+ # <version> — YYYY-MM-DD
37
+
38
+ <!--
39
+ AUTHORING GUIDE — applies to the new per-version file you create from this
40
+ template.
41
+
42
+ Audience: someone scanning release notes to decide what affects them. Lead
43
+ each bullet with the symbol or concept name in **bold** so they can skip
44
+ what's irrelevant and zoom in on what's not.
45
+
46
+ Tone: terse, fact-dense, not verbose. Bullet shape: **symbol** + what
47
+ changed + at most one consumer-facing caveat. One sentence by default, two
48
+ when the second carries weight — a bullet past ~40 words or three sentences
49
+ is wrong. The depth lives one hop away: the linked issue carries the why,
50
+ the commit diff carries the how. The changelog names what changed and what
51
+ a consumer does about it; a reader who wants mechanism opens the link.
52
+
53
+ Model length on THIS guide, never on the previous entry — entries modeled
54
+ on entries compound.
55
+
56
+ Cut (each has shipped as a wall of text; these are the cruft):
57
+ - History/justification narration — how the bug worked, why the old
58
+ behavior was wrong. One short clause at most; the issue carries the story.
59
+ - Design-rationale defense — "chosen over Y because…", "guarding the
60
+ getter is not enough…". That is the author arguing with a reviewer;
61
+ reviewers read the PR, not the changelog.
62
+ - Defensive unchanged-clauses — "X is unchanged", "byte-identical to
63
+ <prev>". Keep one only where its absence would cause a real misread,
64
+ as a short parenthetical.
65
+ - Edge-case inventories — marker lists, not-flagged lists, escape tables.
66
+ Tests and the issue carry those.
67
+ - Mechanism walkthroughs (JSDoc, CLAUDE.md/AGENTS.md, or the relevant
68
+ skill own those), ceremonial framings ("This release introduces…"),
69
+ backwards-compat paragraphs, file-by-file test enumerations. Prefer
70
+ code/symbol names over English re-explanations.
71
+
72
+ Verified ≠ included: the every-claim-verified-from-the-diff rule bounds
73
+ the TRUTH of what you write, never the AMOUNT.
74
+
75
+ Example — same fact, right size:
76
+
77
+ TOO LONG: **`parseJats` keeps the real abstract** (#12). JATS allows
78
+ several `<abstract>` elements and the parser took the first, so an
79
+ article whose graphical abstract precedes the main one returned the
80
+ graphical text as its abstract. Abstracts are now classified by
81
+ `@abstract-type` and `@specific-use`, the main one is chosen first,
82
+ and the rest are kept under their own kinds; …
83
+ [+90 more words of mechanism and edge cases]
84
+
85
+ RIGHT: **`parseJats` no longer lets a graphical abstract replace the
86
+ main one** (#12). Every abstract is kept in `abstracts[]` with its
87
+ `kind`; renderers pick `main` first.
88
+
89
+ Narrative intro: skip by default. Add one short sentence only when the
90
+ release theme genuinely needs framing the bullets can't carry. When many
91
+ bullets share one upgrade consequence, state it ONCE — intro line or
92
+ agent-notes — never per bullet.
93
+
94
+ Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
95
+ Fixed, Security. Include only sections with entries; delete the rest
96
+ (including the commented-out scaffolding below). Don't ship empty headers.
97
+
98
+ Include: every distinct fact a reader needs to adopt or audit the release —
99
+ new exports, signatures, model fields, warning codes, breaking changes,
100
+ corpus coverage that changes what a consumer can rely on. Nothing more.
101
+
102
+ Links: link issues, PRs, docs, or skills where they help a reader jump to
103
+ context. Once per item per entry — don't re-link the same issue in summary,
104
+ narrative, and bullet. Skip links for inline symbol names; code spans speak
105
+ for themselves.
106
+
107
+ Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
108
+ inside its own UI, not in npm reads or local editors.
109
+
110
+ [#38](https://github.com/cyanheads/scholarly-parse/issues/38) ← issue
111
+ [#42](https://github.com/cyanheads/scholarly-parse/pull/42) ← PR
112
+
113
+ Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
114
+ Never speculate on a future number — `#42` for an upcoming PR silently
115
+ resolves to whatever real item already owns 42, and timeline previews pull
116
+ in that unrelated item's metadata.
117
+
118
+ TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
119
+ via `gh release create --notes-from-tag`. It is a condensed digest of this
120
+ entry, never a copy, and its format is owned by the `release-and-publish`
121
+ skill (step 4, "Create the annotated tag"): a short subject line without the
122
+ version, flat headline bullets — no Keep-a-Changelog section headers, no
123
+ gates line — at most one deps line, issue backlinks, and the changelog link
124
+ last. In release-PR mode the `git-wrapup` skill authors those bullets as the
125
+ PR body's `## Changes` and the tag copies them.
126
+ -->
127
+
128
+ ## Added
129
+
130
+ -
131
+
132
+ ## Changed
133
+
134
+ -
135
+
136
+ <!-- ## Deprecated
137
+
138
+ - -->
139
+
140
+ <!-- ## Removed
141
+
142
+ - -->
143
+
144
+ ## Fixed
145
+
146
+ -
147
+
148
+ <!-- ## Security
149
+
150
+ - -->
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @fileoverview Format sniffing: which parser a document needs, from its first bytes.
3
+ * @module src/detect
4
+ */
5
+ import type { SourceFormat } from './model/document.js';
6
+ /**
7
+ * The format of `input`, or undefined when it is none this package reads. A challenge or
8
+ * access-denied page is `html`; the HTML parser reports it as `blocked`.
9
+ */
10
+ export declare function detect(input: string | Uint8Array): SourceFormat | undefined;
11
+ //# sourceMappingURL=detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKxD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,CAqB3E"}
package/dist/detect.js ADDED
@@ -0,0 +1,51 @@
1
+ /** How much of the input the sniffers read: headers and root elements sit at the start. */
2
+ const SNIFF_BYTES = 64 * 1024;
3
+ /**
4
+ * The format of `input`, or undefined when it is none this package reads. A challenge or
5
+ * access-denied page is `html`; the HTML parser reports it as `blocked`.
6
+ */
7
+ export function detect(input) {
8
+ const head = typeof input === 'string'
9
+ ? input.slice(0, SNIFF_BYTES)
10
+ : latin1(input.subarray(0, SNIFF_BYTES));
11
+ if (/^[\s\S]{0,1024}%PDF-/.test(head))
12
+ return 'pdf';
13
+ const text = head.replace(/^/, '').replace(/^\s+/, '');
14
+ if (!text.startsWith('<'))
15
+ return;
16
+ // TEI before HTML: OpenAlex serves Grobid's TEI wrapped in an HTML page.
17
+ if (/<TEI[\s>]|xmlns=["']http:\/\/www\.tei-c\.org\/ns\/1\.0["']/i.test(text))
18
+ return 'tei';
19
+ if (/^(?:<!DOCTYPE\s+(?:article|pmc-articleset)\b|<article[\s>]|<pmc-articleset[\s>])/i.test(afterProlog(text))) {
20
+ return 'jats';
21
+ }
22
+ // Each `<meta` is read up to the next `<`: a run of unclosed ones is scanned once, not once per tag.
23
+ if (/\bltx_document\b|<meta[^<>]+content=["']LaTeXML/i.test(text))
24
+ return 'latexml';
25
+ if (/<(?:!DOCTYPE\s+html|html|head|body)[\s>]/i.test(text))
26
+ return 'html';
27
+ return;
28
+ }
29
+ /**
30
+ * The text from the root element on, past an XML declaration and the comments and
31
+ * whitespace before the root. Scanned forward once: a regex over a run of comments
32
+ * backtracks exponentially when the root after them does not match.
33
+ */
34
+ function afterProlog(text) {
35
+ let at = /^<\?xml[^>]*>/i.exec(text)?.[0].length ?? 0;
36
+ for (;;) {
37
+ while (/\s/.test(text.charAt(at)))
38
+ at++;
39
+ if (!text.startsWith('<!--', at))
40
+ return text.slice(at);
41
+ const end = text.indexOf('-->', at + 4);
42
+ if (end === -1)
43
+ return '';
44
+ at = end + 3;
45
+ }
46
+ }
47
+ /** Bytes as Latin-1 text: enough to sniff ASCII markup whatever the real encoding. */
48
+ function latin1(bytes) {
49
+ return new TextDecoder('latin1').decode(bytes);
50
+ }
51
+ //# sourceMappingURL=detect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAMA,2FAA2F;AAC3F,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,CAAC;AAE9B;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,KAA0B;IAC/C,MAAM,IAAI,GACR,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;QAC7B,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;IAC7C,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACpD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO;IAClC,yEAAyE;IACzE,IAAI,6DAA6D,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3F,IACE,mFAAmF,CAAC,IAAI,CACtF,WAAW,CAAC,IAAI,CAAC,CAClB,EACD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,qGAAqG;IACrG,IAAI,kDAAkD,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACpF,IAAI,2CAA2C,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1E,OAAO;AACT,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;IACtD,SAAS,CAAC;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAAE,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACxD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;QACxC,IAAI,GAAG,KAAK,CAAC,CAAC;YAAE,OAAO,EAAE,CAAC;QAC1B,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;IACf,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,SAAS,MAAM,CAAC,KAAiB;IAC/B,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @fileoverview Publisher HTML → typed blocks. Figures and tables are recognized by
3
+ * their container (`<figure>`, or an element whose class names a figure or table) and
4
+ * read whole: image or grid, label, and caption, with the container's download and
5
+ * "full size" links left out. Display math is read from equation containers and
6
+ * MathJax display scripts.
7
+ * @module src/formats/html/blocks
8
+ */
9
+ import type { Block } from '../../model/document.js';
10
+ import { type HtmlContext } from './context.js';
11
+ /** What a container holds, when it is a figure, table, or supplementary file read as one block. */
12
+ export type FloatKind = 'figure' | 'table' | 'supplement';
13
+ /**
14
+ * A figure, table, or supplementary-file container, or undefined. `<table>` and
15
+ * `<figure>` qualify by tag; other elements by a class token (`figure`, `fig`, `table`,
16
+ * `tw`, `supplementary`) together with the image, table, or file link they wrap, so a
17
+ * class alone never swallows a section.
18
+ */
19
+ export declare function floatKind(element: Element): FloatKind | undefined;
20
+ /** Blocks for a node list, in document order. */
21
+ export declare function flowBlocks(nodes: Node[], ctx: HtmlContext): Block[];
22
+ /** Link-list words publishers put in captions and reference entries, not part of the text. */
23
+ export declare const LINK_LABEL: RegExp;
24
+ /**
25
+ * True for an element that holds only links and link-list words ("Download: PNG TIFF",
26
+ * "Full size image", "[DOI] [PubMed]"): navigation around a caption, not caption text.
27
+ */
28
+ export declare function isLinkList(element: Element): boolean;
29
+ //# sourceMappingURL=blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/formats/html/blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,KAAK,EACV,KAAK,EAKN,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,KAAK,WAAW,EAA2B,MAAM,cAAc,CAAC;AAuCzE,mGAAmG;AACnG,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAY1D;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAyBjE;AAoED,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,WAAW,GAAG,KAAK,EAAE,CAKnE;AAgID,8FAA8F;AAC9F,eAAO,MAAM,UAAU,QACid,CAAC;AAEze;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAUpD"}