diff --git a/_quarto.yml b/_quarto.yml
index 4f16d21..d774272 100644
--- a/_quarto.yml
+++ b/_quarto.yml
@@ -29,3 +29,6 @@ format:
- templates/typst/typst-template.typ
- templates/typst/typst-show.typ
- templates/typst/page.typ
+ filters:
+ - filters/ltr-spans.lua
+ - filters/typst-linebreaks.lua
diff --git a/filters/ltr-spans.lua b/filters/ltr-spans.lua
new file mode 100644
index 0000000..f502fc8
--- /dev/null
+++ b/filters/ltr-spans.lua
@@ -0,0 +1,15 @@
+-- Preserve [text]{dir="ltr"} in Typst PDF (Pandoc HTML keeps the attribute;
+-- Typst needs an explicit text(dir: ltr) wrapper).
+function Span(el)
+ if not el.attributes or el.attributes.dir ~= "ltr" then
+ return nil
+ end
+ if not quarto.doc.is_format("typst") then
+ return nil
+ end
+ local text = pandoc.utils.stringify(el.content)
+ :gsub("\\", "\\\\")
+ :gsub("%]", "\\]")
+ :gsub("@", "\\@")
+ return pandoc.RawInline("typst", "#text(dir: ltr)[" .. text .. "]")
+end
diff --git a/filters/typst-linebreaks.lua b/filters/typst-linebreaks.lua
new file mode 100644
index 0000000..b071243
--- /dev/null
+++ b/filters/typst-linebreaks.lua
@@ -0,0 +1,20 @@
+-- Turn HTML
/ LineBreak into Typst #linebreak() so two-line table
+-- headers work in PDF as well as HTML.
+local function typst_break()
+ return pandoc.RawInline("typst", "#linebreak()")
+end
+
+function RawInline(el)
+ if not quarto.doc.is_format("typst") then
+ return nil
+ end
+ if el.format == "html" and el.text:match("^
$") then
+ return typst_break()
+ end
+end
+
+function LineBreak()
+ if quarto.doc.is_format("typst") then
+ return typst_break()
+ end
+end
diff --git a/styles/report.css b/styles/report.css
index 3e95548..50416d7 100644
--- a/styles/report.css
+++ b/styles/report.css
@@ -12,6 +12,14 @@
font-style: normal;
}
+:root {
+ --text: #1f2328;
+ --text2: #57606a;
+ --stroke: #d0d7de;
+ --bg: #ffffff;
+ --fill: #f6f8fa;
+}
+
html {
direction: rtl;
lang: fa;
@@ -24,8 +32,8 @@ body {
max-width: 48rem;
margin: 2rem auto;
padding: 0 1.25rem;
- color: #1a1a1a;
- background: #fff;
+ color: var(--text);
+ background: var(--bg);
}
h1, h2, h3 {
@@ -67,21 +75,43 @@ p.author,
margin: 0.15rem 0 0.5rem 0;
}
+/* Match Inco Mixed ICJ108 HTML table chrome */
table {
+ border-collapse: separate;
+ border-spacing: 0;
width: 100%;
- border-collapse: collapse;
margin: 1rem 0;
- font-size: 0.95rem;
+ border: 1px solid var(--stroke);
+ border-radius: 8px;
+ overflow: hidden;
}
th, td {
- border: 1px solid #ccc;
- padding: 0.4rem 0.6rem;
+ padding: 0.55rem 0.75rem;
text-align: center;
+ font-size: 1.05rem;
+ font-variant-numeric: tabular-nums;
+ border: none;
}
-th {
- background: #eee;
+thead th {
+ background: var(--fill);
+ font-size: 1rem;
+ color: var(--text2);
+ border-bottom: 1px solid var(--stroke);
+ line-height: 1.35;
+}
+
+tbody tr + tr td {
+ border-top: 1px solid var(--stroke);
+}
+
+/* Keep compound LTR numerics (e.g. 0.850 ± 0.05) in visual LTR order inside RTL tables */
+table [dir="ltr"],
+table .ltr {
+ direction: ltr;
+ unicode-bidi: isolate;
+ display: inline-block;
}
code {