decktile 0.2.2__tar.gz → 0.2.4__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.
- {decktile-0.2.2 → decktile-0.2.4}/PKG-INFO +13 -5
- {decktile-0.2.2 → decktile-0.2.4}/README.md +12 -4
- {decktile-0.2.2 → decktile-0.2.4}/pyproject.toml +1 -1
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/cli.py +1 -1
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/plugins/directives.py +15 -2
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/pdf.py +1 -1
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/pdg.py +7 -6
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/seaborn.py +10 -4
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_cli.py +17 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_parser.py +10 -0
- {decktile-0.2.2 → decktile-0.2.4}/LICENSE +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/__init__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/__main__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/assets/lucide/VENDORED.md +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/assets/lucide/lucide.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/assets/lucide/lucide.ttf +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/parser/__init__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/parser/ast.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/parser/markdown.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/plugins/cards.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/plugins/fenced.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/plugins/layouts.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/plugins/lucide.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/plugins/lucide_font.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/__init__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/html.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/ir.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/odf/__init__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/odf/geometry.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/odf/shapes.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/odf/styles.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/odp.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/templates/base.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/templates/decktile.js +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/render/templates/shell.html +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/seaborn_styles/__init__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/seaborn_styles/ossummit_europe.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/theme/__init__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/theme/colors.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/theme/loader.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/theme/parser.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/themes/default.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/themes/kcd_vietnam.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/themes/kubecon_china.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/themes/kubecon_japan.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/themes/ossummit_europe.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/src/decktile/themes/ossummit_korea.css +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/__init__.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_geometry.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_html.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_ir.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_odf_shapes.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_odp.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_pdg.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_seaborn_styles.py +0 -0
- {decktile-0.2.2 → decktile-0.2.4}/tests/test_video.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: decktile
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Markdown to designed slides: HTML, PDF and editable ODP
|
|
5
5
|
Author-Email: Reza Jelveh <git@jelveh.me>
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -97,7 +97,8 @@ pdm install -G plot # + seaborn/matplotlib for inline charts
|
|
|
97
97
|
pdm run decktile slides.md # HTML + presenter view
|
|
98
98
|
pdm run decktile slides.md --odp # + ODP (programmatic)
|
|
99
99
|
pdm run decktile slides.md --image-odp # + ODP (screenshots from PDF)
|
|
100
|
-
pdm run decktile slides.md --pdf # + PDF
|
|
100
|
+
pdm run decktile slides.md --pdf # + PDF (images compressed)
|
|
101
|
+
pdm run decktile slides.md --pdf --no-optimize-images # + PDF, full-resolution images
|
|
101
102
|
pdm run decktile -w slides.md # watch and rebuild on changes
|
|
102
103
|
pdm run decktile --odp -w slides.md # watch + ODP
|
|
103
104
|
pdm run decktile --dist slides.md # HTML + all referenced assets as zip
|
|
@@ -355,9 +356,9 @@ The arrow block accepts text or images:
|
|
|
355
356
|
| col1 | col2 | # pipe table
|
|
356
357
|
`inline code` # inline code
|
|
357
358
|
```language # fenced code block with syntax highlighting
|
|
359
|
+
```pdg # predictygraph diagram, inline SVG (recommended)
|
|
358
360
|
```mermaid # Mermaid diagram, inline SVG
|
|
359
361
|
```seaborn # Seaborn chart, inline SVG
|
|
360
|
-
```pdg # predictygraph diagram, inline SVG
|
|
361
362
|
```
|
|
362
363
|
|
|
363
364
|
Card/grid `{...}` attributes: bare words are CSS classes (`{metric}` → `.card.metric`),
|
|
@@ -386,7 +387,10 @@ No configuration needed - `pdm install` includes the dependency.
|
|
|
386
387
|
## Diagrams (predictygraph)
|
|
387
388
|
|
|
388
389
|
` ```pdg ` blocks are drawn with [predictygraph](https://pypi.org/project/predictygraph/),
|
|
389
|
-
installed with decktile. Nothing else to install.
|
|
390
|
+
installed with decktile. Nothing else to install. **predictygraph is the recommended
|
|
391
|
+
way to draw diagrams in decktile**, ahead of mermaid: it takes the slide's font and tag
|
|
392
|
+
colours, its layout is predictable and readable, and it can animate
|
|
393
|
+
(see [Animated diagrams](#animated-diagrams) below). Node classes match decktile tag colours:
|
|
390
394
|
|
|
391
395
|
````markdown
|
|
392
396
|
```pdg
|
|
@@ -447,6 +451,9 @@ graph LR
|
|
|
447
451
|
|
|
448
452
|
Renders inline SVG in HTML, PDF in ODP. Uses the `mermaidx` Python package.
|
|
449
453
|
|
|
454
|
+
For new diagrams, prefer ` ```pdg ` ([predictygraph](#diagrams-predictygraph)): it
|
|
455
|
+
follows the slide theme and can animate. Mermaid is there for diagrams you already have.
|
|
456
|
+
|
|
450
457
|
## Seaborn charts
|
|
451
458
|
|
|
452
459
|
````markdown
|
|
@@ -548,7 +555,7 @@ back to light mode on the next slide.
|
|
|
548
555
|
## Theming
|
|
549
556
|
|
|
550
557
|
Colors, borders, and spacing use CSS custom properties. Override them via
|
|
551
|
-
frontmatter `style:` block or a custom theme file. See [THEMING.md](docs/
|
|
558
|
+
frontmatter `style:` block or a custom theme file. See [THEMING.md](docs/theming.md)
|
|
552
559
|
for the full variable reference.
|
|
553
560
|
|
|
554
561
|
```yaml
|
|
@@ -583,6 +590,7 @@ and all directives.
|
|
|
583
590
|
|
|
584
591
|
See also: `examples/mermaid_demo.md`, `examples/seaborn_demo.md`,
|
|
585
592
|
`examples/pdg_demo.md`, `examples/lucide_demo.md`, `examples/timeline_demo.md`.
|
|
593
|
+
`examples/seaborn_demo.md` ends with hand-drawn matplotlib explainer charts from a real talk.
|
|
586
594
|
|
|
587
595
|
## Pipeline
|
|
588
596
|
|
|
@@ -68,7 +68,8 @@ pdm install -G plot # + seaborn/matplotlib for inline charts
|
|
|
68
68
|
pdm run decktile slides.md # HTML + presenter view
|
|
69
69
|
pdm run decktile slides.md --odp # + ODP (programmatic)
|
|
70
70
|
pdm run decktile slides.md --image-odp # + ODP (screenshots from PDF)
|
|
71
|
-
pdm run decktile slides.md --pdf # + PDF
|
|
71
|
+
pdm run decktile slides.md --pdf # + PDF (images compressed)
|
|
72
|
+
pdm run decktile slides.md --pdf --no-optimize-images # + PDF, full-resolution images
|
|
72
73
|
pdm run decktile -w slides.md # watch and rebuild on changes
|
|
73
74
|
pdm run decktile --odp -w slides.md # watch + ODP
|
|
74
75
|
pdm run decktile --dist slides.md # HTML + all referenced assets as zip
|
|
@@ -326,9 +327,9 @@ The arrow block accepts text or images:
|
|
|
326
327
|
| col1 | col2 | # pipe table
|
|
327
328
|
`inline code` # inline code
|
|
328
329
|
```language # fenced code block with syntax highlighting
|
|
330
|
+
```pdg # predictygraph diagram, inline SVG (recommended)
|
|
329
331
|
```mermaid # Mermaid diagram, inline SVG
|
|
330
332
|
```seaborn # Seaborn chart, inline SVG
|
|
331
|
-
```pdg # predictygraph diagram, inline SVG
|
|
332
333
|
```
|
|
333
334
|
|
|
334
335
|
Card/grid `{...}` attributes: bare words are CSS classes (`{metric}` → `.card.metric`),
|
|
@@ -357,7 +358,10 @@ No configuration needed - `pdm install` includes the dependency.
|
|
|
357
358
|
## Diagrams (predictygraph)
|
|
358
359
|
|
|
359
360
|
` ```pdg ` blocks are drawn with [predictygraph](https://pypi.org/project/predictygraph/),
|
|
360
|
-
installed with decktile. Nothing else to install.
|
|
361
|
+
installed with decktile. Nothing else to install. **predictygraph is the recommended
|
|
362
|
+
way to draw diagrams in decktile**, ahead of mermaid: it takes the slide's font and tag
|
|
363
|
+
colours, its layout is predictable and readable, and it can animate
|
|
364
|
+
(see [Animated diagrams](#animated-diagrams) below). Node classes match decktile tag colours:
|
|
361
365
|
|
|
362
366
|
````markdown
|
|
363
367
|
```pdg
|
|
@@ -418,6 +422,9 @@ graph LR
|
|
|
418
422
|
|
|
419
423
|
Renders inline SVG in HTML, PDF in ODP. Uses the `mermaidx` Python package.
|
|
420
424
|
|
|
425
|
+
For new diagrams, prefer ` ```pdg ` ([predictygraph](#diagrams-predictygraph)): it
|
|
426
|
+
follows the slide theme and can animate. Mermaid is there for diagrams you already have.
|
|
427
|
+
|
|
421
428
|
## Seaborn charts
|
|
422
429
|
|
|
423
430
|
````markdown
|
|
@@ -519,7 +526,7 @@ back to light mode on the next slide.
|
|
|
519
526
|
## Theming
|
|
520
527
|
|
|
521
528
|
Colors, borders, and spacing use CSS custom properties. Override them via
|
|
522
|
-
frontmatter `style:` block or a custom theme file. See [THEMING.md](docs/
|
|
529
|
+
frontmatter `style:` block or a custom theme file. See [THEMING.md](docs/theming.md)
|
|
523
530
|
for the full variable reference.
|
|
524
531
|
|
|
525
532
|
```yaml
|
|
@@ -554,6 +561,7 @@ and all directives.
|
|
|
554
561
|
|
|
555
562
|
See also: `examples/mermaid_demo.md`, `examples/seaborn_demo.md`,
|
|
556
563
|
`examples/pdg_demo.md`, `examples/lucide_demo.md`, `examples/timeline_demo.md`.
|
|
564
|
+
`examples/seaborn_demo.md` ends with hand-drawn matplotlib explainer charts from a real talk.
|
|
557
565
|
|
|
558
566
|
## Pipeline
|
|
559
567
|
|
|
@@ -24,7 +24,7 @@ def main(
|
|
|
24
24
|
odp: bool = typer.Option(False, "--odp", help="Generate ODP (programmatic)"),
|
|
25
25
|
image_odp: bool = typer.Option(False, "--image-odp", help="Generate ODP (PDF screenshots)"),
|
|
26
26
|
dist: bool = typer.Option(False, "--dist", help="Package HTML + referenced assets into a zip"),
|
|
27
|
-
optimize_images: bool = typer.Option(
|
|
27
|
+
optimize_images: bool = typer.Option(True, "--optimize-images/--no-optimize-images", help="Compress images in PDF output (jpeg_quality=85, dpi=150). On by default; --no-optimize-images keeps full-resolution images"),
|
|
28
28
|
watch: bool = typer.Option(False, "-w", "--watch", help="Watch file and rebuild on changes"),
|
|
29
29
|
debug: bool = typer.Option(False, "--debug", help="Dump AST + write debug CSS"),
|
|
30
30
|
css: Optional[Path] = typer.Option(None, "--css", help="Custom CSS theme file (overrides default)"),
|
|
@@ -5,12 +5,25 @@ from decktile.parser.ast import AttrNode, Paragraph, Text, Node
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def preprocess_directives(content: str) -> str:
|
|
8
|
-
"""Convert @directive lines to HTML comment markers.
|
|
8
|
+
"""Convert @directive lines to HTML comment markers.
|
|
9
|
+
|
|
10
|
+
Lines inside fenced code blocks (``` or ~~~) are left alone, so a code
|
|
11
|
+
sample can show directive syntax without it being applied.
|
|
12
|
+
"""
|
|
9
13
|
lines = content.split("\n")
|
|
10
14
|
result = []
|
|
15
|
+
fence = None
|
|
11
16
|
for line in lines:
|
|
12
17
|
stripped = line.strip()
|
|
13
|
-
|
|
18
|
+
m = re.match(r"(`{3,}|~{3,})", stripped)
|
|
19
|
+
if m:
|
|
20
|
+
if fence is None:
|
|
21
|
+
fence = m.group(1)
|
|
22
|
+
elif stripped.startswith(fence) and not stripped[len(fence):].strip():
|
|
23
|
+
fence = None
|
|
24
|
+
result.append(line)
|
|
25
|
+
continue
|
|
26
|
+
if fence is None and stripped.startswith("@") and not stripped.startswith("@@"):
|
|
14
27
|
parts = stripped[1:].split(" ", 1)
|
|
15
28
|
typ = parts[0]
|
|
16
29
|
value = parts[1] if len(parts) > 1 else ""
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def render(html_path: Path, output_path: Path, optimize_images: bool =
|
|
6
|
+
def render(html_path: Path, output_path: Path, optimize_images: bool = True) -> None:
|
|
7
7
|
from weasyprint import HTML # lazy: needs system Pango, only for PDF/ODP output
|
|
8
8
|
|
|
9
9
|
if optimize_images:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"""predictygraph renderer for decktile
|
|
1
|
+
"""predictygraph renderer for decktile ``pdg`` fenced blocks.
|
|
2
2
|
|
|
3
3
|
The slide theme's body font and tag colours are passed to predictygraph as a
|
|
4
|
-
stylesheet layered under the diagram's own css, so
|
|
5
|
-
|
|
4
|
+
stylesheet layered under the diagram's own css, so ``node.green``, ``node.cyan``,
|
|
5
|
+
``node.yellow`` and ``node.red`` match decktile cards and anything in the block wins.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
@@ -52,9 +52,10 @@ def render_pdg_svg(content: str, font_family: str = "", font_size: int = 0,
|
|
|
52
52
|
blueprint: bool = False, animated: bool = False) -> str | None:
|
|
53
53
|
"""Render a predictygraph diagram to SVG, or None if it fails to parse.
|
|
54
54
|
|
|
55
|
-
blueprint
|
|
56
|
-
animated
|
|
57
|
-
|
|
55
|
+
``blueprint`` uses the palette for ``::: card {blueprint}`` (light lines,
|
|
56
|
+
translucent fills). ``animated`` keeps predictygraph's SMIL animation
|
|
57
|
+
(``flow=``, ``border=``) for HTML; the default is a still frame, which PDF
|
|
58
|
+
and ODP need.
|
|
58
59
|
"""
|
|
59
60
|
import predictygraph
|
|
60
61
|
|
|
@@ -104,10 +104,16 @@ def set_theme(name: str) -> None:
|
|
|
104
104
|
# 2) CSS theme file (single source of truth for brand colors)
|
|
105
105
|
css_style = _css_theme_rcparams(name)
|
|
106
106
|
if css_style:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
try:
|
|
108
|
+
import matplotlib
|
|
109
|
+
matplotlib.use("Agg")
|
|
110
|
+
import matplotlib.pyplot as plt
|
|
111
|
+
import seaborn as sns
|
|
112
|
+
except ImportError:
|
|
113
|
+
# charts are optional (decktile[plot]); without them seaborn blocks
|
|
114
|
+
# fall back to code, so the theme has nothing to apply to
|
|
115
|
+
_palette, _style = name, None
|
|
116
|
+
return
|
|
111
117
|
palette = css_style.pop("seaborn_palette", _DEFAULT_PALETTE)
|
|
112
118
|
sns.set_theme(style="darkgrid", palette=palette)
|
|
113
119
|
plt.rcParams.update(css_style)
|
|
@@ -47,3 +47,20 @@ def test_main_failing_file_does_not_stop_the_rest(tmp_path):
|
|
|
47
47
|
assert result.exit_code == 1
|
|
48
48
|
assert "bad.md:" in result.output and "missing.md: no such file" in result.output
|
|
49
49
|
assert (tmp_path / "out" / "good.html").exists()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_seaborn_theme_without_chart_libraries(monkeypatch):
|
|
53
|
+
"""seaborn_theme in frontmatter must not crash a build when matplotlib isn't installed."""
|
|
54
|
+
import builtins
|
|
55
|
+
|
|
56
|
+
from decktile.render import seaborn as sb
|
|
57
|
+
|
|
58
|
+
real_import = builtins.__import__
|
|
59
|
+
|
|
60
|
+
def no_plot(name, *a, **k):
|
|
61
|
+
if name.split(".")[0] in ("matplotlib", "seaborn"):
|
|
62
|
+
raise ImportError(name)
|
|
63
|
+
return real_import(name, *a, **k)
|
|
64
|
+
|
|
65
|
+
monkeypatch.setattr(builtins, "__import__", no_plot)
|
|
66
|
+
sb.set_theme("default") # must not raise
|
|
@@ -173,3 +173,13 @@ def test_group_cards_without_blank_lines_before_paragraph():
|
|
|
173
173
|
nodes = parse("---\ntitle: t\n---\n\n" + md + "\nAfter.\n").slides[0].children
|
|
174
174
|
assert [type(n).__name__ for n in nodes] == ["Grid", "Paragraph"]
|
|
175
175
|
assert [c.tag for c in nodes[0].children] == ["cyan", "green", "red"]
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def test_directive_inside_code_fence_is_left_as_code():
|
|
179
|
+
from decktile.parser.ast import AttrNode
|
|
180
|
+
from decktile.parser.markdown import parse
|
|
181
|
+
md = "## S\n\n```markdown\n@video clip.mp4\n@layout two-col\n```\n"
|
|
182
|
+
slide = parse(md).slides[0]
|
|
183
|
+
assert not any(isinstance(n, AttrNode) for n in slide.children)
|
|
184
|
+
code = [n for n in slide.children if getattr(n, "language", None) == "markdown"]
|
|
185
|
+
assert code and "@video clip.mp4" in code[0].content
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|