@imontene/mdrender 2.8.1 → 2.9.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.
- package/CHANGELOG.md +6 -0
- package/README.md +6 -5
- package/dist/convert.js +11 -5
- package/dist/markdown/hyphenate.js +7 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Cambios
|
|
2
2
|
|
|
3
|
+
## 2.9.0 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Los elementos de listas con viñetas y numeradas (también anidadas o dentro de citas y
|
|
6
|
+
alertas) se justifican en el PDF como los demás párrafos, con partición de palabras. El
|
|
7
|
+
código y las tablas dentro de una lista siguen alineados a la izquierda.
|
|
8
|
+
|
|
3
9
|
## 2.8.1 — 2026-10-29
|
|
4
10
|
|
|
5
11
|
- Tema `academic_basic`: márgenes laterales de 8 mm (antes 16 mm), con más ancho para las dos
|
package/README.md
CHANGED
|
@@ -240,11 +240,12 @@ Ambas van incrustadas en el PDF, también en el encabezado, el pie y los diagram
|
|
|
240
240
|
tiene cursivas (el navegador inclina la normal) ni algunos símbolos como `→`, `✓` o `≤`, que
|
|
241
241
|
se toman de Inter.
|
|
242
242
|
|
|
243
|
-
**Párrafos justificados**: en el PDF, los párrafos del texto, de las citas y de las alertas
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
**Párrafos justificados**: en el PDF, los párrafos del texto, de las citas y de las alertas, y
|
|
244
|
+
los elementos de listas con viñetas o numeradas (también anidadas) se justifican, y las palabras
|
|
245
|
+
largas se parten con guion al final de la línea según el idioma del documento (`lang`: español,
|
|
246
|
+
inglés, portugués, francés, alemán o italiano; en otros idiomas se justifica sin partir
|
|
247
|
+
palabras). Tablas, notas al pie, el índice, los diagramas y el código dentro de una lista quedan
|
|
248
|
+
alineados a la izquierda, y el HTML no cambia. El texto del PDF solo lleva el guion donde
|
|
248
249
|
la palabra se corta, así que copiar y buscar funcionan con las palabras completas.
|
|
249
250
|
`--no-justify` (o `justify: false`) vuelve a alinear a la izquierda.
|
|
250
251
|
|
package/dist/convert.js
CHANGED
|
@@ -85,16 +85,22 @@ export function headerFooterSpaceWarnings(margin, hasHeader, hasFooter) {
|
|
|
85
85
|
return warnings;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* Justified
|
|
89
|
-
* (the same ones markdown/hyphenate.ts gives soft hyphens).
|
|
90
|
-
* block, the table of contents and diagram labels stay aligned
|
|
91
|
-
* HTML keeps ragged lines.
|
|
88
|
+
* Justified text in the PDF: the body's paragraphs, those directly inside a quote or an alert,
|
|
89
|
+
* and bulleted and numbered list items (the same ones markdown/hyphenate.ts gives soft hyphens).
|
|
90
|
+
* Tables, footnotes, the title block, the table of contents and diagram labels stay aligned
|
|
91
|
+
* left, as does code inside a list item. Print only: on screen the HTML keeps ragged lines.
|
|
92
92
|
*/
|
|
93
93
|
const JUSTIFY_CSS = `@media print {
|
|
94
94
|
.markdown-body > p,
|
|
95
|
-
.markdown-body > blockquote > p:not(.markdown-alert-title)
|
|
95
|
+
.markdown-body > blockquote > p:not(.markdown-alert-title),
|
|
96
|
+
.markdown-body > :is(ul, ol) li,
|
|
97
|
+
.markdown-body > blockquote > :is(ul, ol) li {
|
|
96
98
|
text-align: justify;
|
|
97
99
|
}
|
|
100
|
+
/* What list items may hold besides text keeps its own alignment. */
|
|
101
|
+
.markdown-body li :is(pre, table) {
|
|
102
|
+
text-align: start;
|
|
103
|
+
}
|
|
98
104
|
}`;
|
|
99
105
|
/** Font size, if set, and the page's text height (used to fit images and diagrams). */
|
|
100
106
|
function layoutCss(options, margin) {
|
|
@@ -42,12 +42,16 @@ export function hyphenatorFor(lang) {
|
|
|
42
42
|
return hyphenate;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Whether a paragraph is justified
|
|
46
|
-
*
|
|
45
|
+
* Whether a paragraph is justified (the same paragraphs as the print stylesheet in convert.ts):
|
|
46
|
+
* top-level, directly inside a blockquote or alert, or in a bulleted or numbered list item
|
|
47
|
+
* (nested lists too). Footnotes and tables are not.
|
|
47
48
|
*/
|
|
48
49
|
function justified(containers) {
|
|
49
|
-
|
|
50
|
+
// Bulleted and numbered lists (nested too) are justified like the text around them.
|
|
51
|
+
const blocks = containers.filter((c) => !LIST_CONTAINERS.has(c));
|
|
52
|
+
return blocks.length === 0 || (blocks.length === 1 && blocks[0] === "blockquote_open");
|
|
50
53
|
}
|
|
54
|
+
const LIST_CONTAINERS = new Set(["bullet_list_open", "ordered_list_open", "list_item_open"]);
|
|
51
55
|
function hyphenateInline(inline, hyphenate) {
|
|
52
56
|
let inAutolink = 0;
|
|
53
57
|
for (const child of inline.children ?? []) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imontene/mdrender",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Command-line app for Windows and Linux that renders Markdown — with LaTeX equations and Mermaid diagrams — to PDF and HTML set in Manrope or Inter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|