@imontene/mdrender 2.6.1 → 2.7.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 +2 -2
- package/dist/cli.js +1 -1
- package/dist/options.d.ts +1 -1
- package/dist/render/watermark.d.ts +1 -1
- package/dist/render/watermark.js +12 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Cambios
|
|
2
2
|
|
|
3
|
+
## 2.7.0 — 2026-10-23
|
|
4
|
+
|
|
5
|
+
- `--watermark-field` pone ahora dos campos de luz en cada página: arriba a la izquierda (antes
|
|
6
|
+
arriba a la derecha) y uno nuevo abajo a la derecha. El campo junto al título de la primera
|
|
7
|
+
página no cambia.
|
|
8
|
+
|
|
3
9
|
## 2.6.1 — 2026-10-22
|
|
4
10
|
|
|
5
11
|
- **PDF mucho más livianos con los campos de luz.** Chrome convertía los degradados CSS del
|
package/README.md
CHANGED
|
@@ -157,7 +157,7 @@ equipo); `--port` fija el puerto y `--no-open` no abre el navegador.
|
|
|
157
157
|
| `--font <manrope\|inter>` | Tipografía del texto (ver abajo) | `manrope` |
|
|
158
158
|
| `--no-justify` | Párrafos alineados a la izquierda en el PDF (ver abajo) | justificado |
|
|
159
159
|
| `--watermark <texto>` | Marca de agua en diagonal en cada página del PDF, con el degradado Anti-Gravity | — |
|
|
160
|
-
| `--watermark-field` |
|
|
160
|
+
| `--watermark-field` | Campos de luz con el degradado arriba a la izquierda y abajo a la derecha de cada página del PDF | — |
|
|
161
161
|
| `--density <densidad>` | `normal` o `compact` (menos espacio entre líneas y bloques) | `normal` |
|
|
162
162
|
| `--font-size <tamaño>` | Tamaño del texto en `pt` o `px`, de 6 a 24 pt; p. ej. `10pt` | `10.5pt` |
|
|
163
163
|
| `--theme <tema\|css>` | `antigravity`, `antigravity-dark`, `light`, `dark` o un `.css` que reemplaza el tema (ver abajo) | `antigravity` |
|
|
@@ -202,7 +202,7 @@ Anti-Gravity, cada una por separado y solo en el PDF:
|
|
|
202
202
|
|
|
203
203
|
```bash
|
|
204
204
|
mdrender informe.md --watermark "Borrador" # texto en diagonal en cada página
|
|
205
|
-
mdrender informe.md --watermark-field #
|
|
205
|
+
mdrender informe.md --watermark-field # campos de luz arriba a la izquierda y abajo a la derecha
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
También como `watermark: Borrador` y `watermarkField: true` en el front matter o en
|
package/dist/cli.js
CHANGED
|
@@ -66,7 +66,7 @@ function addDocumentOptions(command) {
|
|
|
66
66
|
.option("--font <font>", "text typeface: manrope or inter (default: manrope)")
|
|
67
67
|
.option("--no-justify", "align paragraphs left in the PDF instead of justifying them")
|
|
68
68
|
.option("--watermark <text>", "text across every PDF page, in the Anti-Gravity gradient")
|
|
69
|
-
.option("--watermark-field", "
|
|
69
|
+
.option("--watermark-field", "soft fields of light in the top-left and bottom-right corners of every PDF page")
|
|
70
70
|
.option("--density <density>", "normal or compact (tighter spacing) (default: normal)")
|
|
71
71
|
.option("--font-size <size>", "text size, e.g. 10pt or 11pt (default: 10.5pt)")
|
|
72
72
|
.option("--theme <theme>", "antigravity, antigravity-dark, light, dark, or a .css file replacing the theme " +
|
package/dist/options.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface DocumentOptions {
|
|
|
51
51
|
mermaidFlip: MermaidFlip;
|
|
52
52
|
/** Text set diagonally across every page of the PDF, in the Anti-Gravity gradient. */
|
|
53
53
|
watermark?: string;
|
|
54
|
-
/**
|
|
54
|
+
/** Soft fields of light (the Anti-Gravity gradient) in two corners of every PDF page. */
|
|
55
55
|
watermarkField: boolean;
|
|
56
56
|
/** Justify paragraphs in the PDF (body, quotes, alerts), breaking long words with hyphens. */
|
|
57
57
|
justify: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface WatermarkOptions {
|
|
2
2
|
/** Text set across every page; undefined or blank for none. */
|
|
3
3
|
text?: string;
|
|
4
|
-
/**
|
|
4
|
+
/** Fields of light in the top-left and bottom-right corners of every page. */
|
|
5
5
|
field: boolean;
|
|
6
6
|
/** Size of the text area in CSS px (the text runs along its diagonal). */
|
|
7
7
|
widthPx: number;
|
package/dist/render/watermark.js
CHANGED
|
@@ -2,8 +2,8 @@ import { escapeHtml } from "../html.js";
|
|
|
2
2
|
import { FIELD_COLORS, fieldImage } from "./field.js";
|
|
3
3
|
/**
|
|
4
4
|
* Watermarks in the Anti-Gravity gradient (field-blue → field-cyan → field-violet), PDF only:
|
|
5
|
-
* a text set diagonally across every page, and
|
|
6
|
-
* every page. Both sit behind the content. Chrome repeats a `position: fixed` element on every
|
|
5
|
+
* a text set diagonally across every page, and soft fields of light in the top-left and
|
|
6
|
+
* bottom-right corners of every page. Both sit behind the content. Chrome repeats a `position: fixed` element on every
|
|
7
7
|
* printed page, at the same place in the text area, so pagination is left alone.
|
|
8
8
|
*/
|
|
9
9
|
const FIELD = FIELD_COLORS;
|
|
@@ -23,8 +23,13 @@ function textMark(text, widthPx, heightPx, dark) {
|
|
|
23
23
|
return `<div class="mdr-watermark-text" style="opacity: ${dark ? 0.14 : 0.1}"><span style="font-size: ${fontSize}px; transform: rotate(${(-angle).toFixed(2)}deg)">${escapeHtml(text.toUpperCase())}</span></div>`;
|
|
24
24
|
}
|
|
25
25
|
function fieldMark(dark) {
|
|
26
|
-
// The same field as the title block's (render/field.ts), as a vector SVG image
|
|
27
|
-
|
|
26
|
+
// The same field as the title block's (render/field.ts), as a vector SVG image, in the
|
|
27
|
+
// top-left and bottom-right corners of every page.
|
|
28
|
+
const style = `style="background-image: ${fieldImage(dark)}"`;
|
|
29
|
+
return [
|
|
30
|
+
`<div class="mdr-watermark-field mdr-field-top-left" ${style}></div>`,
|
|
31
|
+
`<div class="mdr-watermark-field mdr-field-bottom-right" ${style}></div>`,
|
|
32
|
+
].join("\n");
|
|
28
33
|
}
|
|
29
34
|
/** HTML of the requested marks, to go before the document body; "" when none is requested. */
|
|
30
35
|
export function watermarkHtml(options) {
|
|
@@ -72,14 +77,15 @@ export const WATERMARK_CSS = `.mdr-watermark { display: none; }
|
|
|
72
77
|
}
|
|
73
78
|
.mdr-watermark-field {
|
|
74
79
|
position: absolute;
|
|
75
|
-
top: 0;
|
|
76
|
-
right: 0;
|
|
77
80
|
width: 40%;
|
|
78
81
|
height: 230px;
|
|
79
82
|
background-position: center;
|
|
80
83
|
background-size: 100% 100%;
|
|
81
84
|
background-repeat: no-repeat;
|
|
82
85
|
}
|
|
86
|
+
/* The lights gather towards the right of the field's box: mirror it so they sit in its corner. */
|
|
87
|
+
.mdr-field-top-left { top: 0; left: 0; transform: scaleX(-1); }
|
|
88
|
+
.mdr-field-bottom-right { bottom: 0; right: 0; transform: scaleY(-1); }
|
|
83
89
|
.mdr-watermark:has(.mdr-watermark-field) ~ .markdown-body .doc-header::before { display: none; }
|
|
84
90
|
}`;
|
|
85
91
|
//# sourceMappingURL=watermark.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imontene/mdrender",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.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",
|