decktile 0.2.3__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.
Files changed (56) hide show
  1. {decktile-0.2.3 → decktile-0.2.4}/PKG-INFO +10 -3
  2. {decktile-0.2.3 → decktile-0.2.4}/README.md +9 -2
  3. {decktile-0.2.3 → decktile-0.2.4}/pyproject.toml +1 -1
  4. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/plugins/directives.py +15 -2
  5. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/seaborn.py +10 -4
  6. {decktile-0.2.3 → decktile-0.2.4}/tests/test_cli.py +17 -0
  7. {decktile-0.2.3 → decktile-0.2.4}/tests/test_parser.py +10 -0
  8. {decktile-0.2.3 → decktile-0.2.4}/LICENSE +0 -0
  9. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/__init__.py +0 -0
  10. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/__main__.py +0 -0
  11. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/assets/lucide/VENDORED.md +0 -0
  12. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/assets/lucide/lucide.css +0 -0
  13. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/assets/lucide/lucide.ttf +0 -0
  14. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/cli.py +0 -0
  15. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/parser/__init__.py +0 -0
  16. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/parser/ast.py +0 -0
  17. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/parser/markdown.py +0 -0
  18. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/plugins/cards.py +0 -0
  19. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/plugins/fenced.py +0 -0
  20. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/plugins/layouts.py +0 -0
  21. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/plugins/lucide.py +0 -0
  22. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/plugins/lucide_font.py +0 -0
  23. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/__init__.py +0 -0
  24. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/html.py +0 -0
  25. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/ir.py +0 -0
  26. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/odf/__init__.py +0 -0
  27. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/odf/geometry.py +0 -0
  28. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/odf/shapes.py +0 -0
  29. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/odf/styles.py +0 -0
  30. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/odp.py +0 -0
  31. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/pdf.py +0 -0
  32. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/pdg.py +0 -0
  33. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/templates/base.css +0 -0
  34. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/templates/decktile.js +0 -0
  35. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/render/templates/shell.html +0 -0
  36. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/seaborn_styles/__init__.py +0 -0
  37. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/seaborn_styles/ossummit_europe.py +0 -0
  38. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/theme/__init__.py +0 -0
  39. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/theme/colors.py +0 -0
  40. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/theme/loader.py +0 -0
  41. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/theme/parser.py +0 -0
  42. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/themes/default.css +0 -0
  43. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/themes/kcd_vietnam.css +0 -0
  44. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/themes/kubecon_china.css +0 -0
  45. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/themes/kubecon_japan.css +0 -0
  46. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/themes/ossummit_europe.css +0 -0
  47. {decktile-0.2.3 → decktile-0.2.4}/src/decktile/themes/ossummit_korea.css +0 -0
  48. {decktile-0.2.3 → decktile-0.2.4}/tests/__init__.py +0 -0
  49. {decktile-0.2.3 → decktile-0.2.4}/tests/test_geometry.py +0 -0
  50. {decktile-0.2.3 → decktile-0.2.4}/tests/test_html.py +0 -0
  51. {decktile-0.2.3 → decktile-0.2.4}/tests/test_ir.py +0 -0
  52. {decktile-0.2.3 → decktile-0.2.4}/tests/test_odf_shapes.py +0 -0
  53. {decktile-0.2.3 → decktile-0.2.4}/tests/test_odp.py +0 -0
  54. {decktile-0.2.3 → decktile-0.2.4}/tests/test_pdg.py +0 -0
  55. {decktile-0.2.3 → decktile-0.2.4}/tests/test_seaborn_styles.py +0 -0
  56. {decktile-0.2.3 → 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
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
@@ -356,9 +356,9 @@ The arrow block accepts text or images:
356
356
  | col1 | col2 | # pipe table
357
357
  `inline code` # inline code
358
358
  ```language # fenced code block with syntax highlighting
359
+ ```pdg # predictygraph diagram, inline SVG (recommended)
359
360
  ```mermaid # Mermaid diagram, inline SVG
360
361
  ```seaborn # Seaborn chart, inline SVG
361
- ```pdg # predictygraph diagram, inline SVG
362
362
  ```
363
363
 
364
364
  Card/grid `{...}` attributes: bare words are CSS classes (`{metric}` → `.card.metric`),
@@ -387,7 +387,10 @@ No configuration needed - `pdm install` includes the dependency.
387
387
  ## Diagrams (predictygraph)
388
388
 
389
389
  ` ```pdg ` blocks are drawn with [predictygraph](https://pypi.org/project/predictygraph/),
390
- installed with decktile. Nothing else to install. Node classes match decktile tag colours:
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:
391
394
 
392
395
  ````markdown
393
396
  ```pdg
@@ -448,6 +451,9 @@ graph LR
448
451
 
449
452
  Renders inline SVG in HTML, PDF in ODP. Uses the `mermaidx` Python package.
450
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
+
451
457
  ## Seaborn charts
452
458
 
453
459
  ````markdown
@@ -584,6 +590,7 @@ and all directives.
584
590
 
585
591
  See also: `examples/mermaid_demo.md`, `examples/seaborn_demo.md`,
586
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.
587
594
 
588
595
  ## Pipeline
589
596
 
@@ -327,9 +327,9 @@ The arrow block accepts text or images:
327
327
  | col1 | col2 | # pipe table
328
328
  `inline code` # inline code
329
329
  ```language # fenced code block with syntax highlighting
330
+ ```pdg # predictygraph diagram, inline SVG (recommended)
330
331
  ```mermaid # Mermaid diagram, inline SVG
331
332
  ```seaborn # Seaborn chart, inline SVG
332
- ```pdg # predictygraph diagram, inline SVG
333
333
  ```
334
334
 
335
335
  Card/grid `{...}` attributes: bare words are CSS classes (`{metric}` → `.card.metric`),
@@ -358,7 +358,10 @@ No configuration needed - `pdm install` includes the dependency.
358
358
  ## Diagrams (predictygraph)
359
359
 
360
360
  ` ```pdg ` blocks are drawn with [predictygraph](https://pypi.org/project/predictygraph/),
361
- installed with decktile. Nothing else to install. Node classes match decktile tag colours:
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:
362
365
 
363
366
  ````markdown
364
367
  ```pdg
@@ -419,6 +422,9 @@ graph LR
419
422
 
420
423
  Renders inline SVG in HTML, PDF in ODP. Uses the `mermaidx` Python package.
421
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
+
422
428
  ## Seaborn charts
423
429
 
424
430
  ````markdown
@@ -555,6 +561,7 @@ and all directives.
555
561
 
556
562
  See also: `examples/mermaid_demo.md`, `examples/seaborn_demo.md`,
557
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.
558
565
 
559
566
  ## Pipeline
560
567
 
@@ -23,7 +23,7 @@ dependencies = [
23
23
  ]
24
24
  requires-python = ">=3.11"
25
25
  readme = "README.md"
26
- version = "0.2.3"
26
+ version = "0.2.4"
27
27
 
28
28
  [project.license]
29
29
  text = "GPL-3.0-or-later"
@@ -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
- if stripped.startswith("@") and not stripped.startswith("@@"):
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 ""
@@ -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
- import matplotlib
108
- matplotlib.use("Agg")
109
- import matplotlib.pyplot as plt
110
- import seaborn as sns
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