markdown_convert 1.2.17__tar.gz → 1.2.19__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown_convert
3
- Version: 1.2.17
3
+ Version: 1.2.19
4
4
  Summary: Convert Markdown files to PDF from your command line.
5
5
  Project-URL: homepage, https://github.com/Julynx/markdown_convert
6
6
  Author-email: Julio Cabria <juliocabria@tutanota.com>
@@ -0,0 +1,223 @@
1
+ :root {
2
+ /* -- Standard margins */
3
+ --top-margin: 0.5em;
4
+ --bottom-margin: 0.5em;
5
+ --left-margin: 1.5em;
6
+
7
+ /* -- Small margins */
8
+ --left-margin-small: 1em;
9
+
10
+ /* -- Big margins */
11
+ --left-margin-big: 2em;
12
+ }
13
+
14
+ /* Document */
15
+ html {
16
+ font-size: 12px;
17
+ }
18
+
19
+ body {
20
+ margin: 0;
21
+ padding: 0;
22
+ font-family: "Segoe UI", "Ubuntu", "DejaVu Sans", "Liberation Sans", "Arial",
23
+ "sans-serif";
24
+ color: #333;
25
+ }
26
+
27
+ /* Headers and paragraphs */
28
+ h1,
29
+ h2,
30
+ h3,
31
+ h4,
32
+ h5 {
33
+ color: #333;
34
+ font-weight: 600;
35
+ }
36
+
37
+ h1 {
38
+ margin-top: 0;
39
+ margin-bottom: var(--bottom-margin);
40
+ }
41
+
42
+ h2,
43
+ h3,
44
+ h4,
45
+ h5,
46
+ p {
47
+ margin-top: var(--top-margin);
48
+ margin-bottom: 0;
49
+ }
50
+
51
+ h1 {
52
+ font-size: 2.4rem;
53
+ }
54
+
55
+ h2 {
56
+ font-size: 2rem;
57
+ }
58
+
59
+ h3 {
60
+ font-size: 1.6rem;
61
+ }
62
+
63
+ h4 {
64
+ font-size: 1.4rem;
65
+ }
66
+
67
+ h5 {
68
+ font-size: 1.2rem;
69
+ }
70
+
71
+ p {
72
+ font-size: 1rem;
73
+ }
74
+
75
+ /* Links */
76
+ a {
77
+ color: #09f;
78
+ margin: 0;
79
+ vertical-align: baseline;
80
+ }
81
+
82
+ /* Lists */
83
+ ul,
84
+ ol {
85
+ font-size: 1rem;
86
+ padding: 0;
87
+ margin-top: var(--top-margin);
88
+ margin-right: 0;
89
+ margin-bottom: var(--bottom-margin);
90
+ margin-left: var(--left-margin-big);
91
+ }
92
+
93
+ ul ol,
94
+ ol ul,
95
+ ol ol,
96
+ ul ul {
97
+ margin-top: 0;
98
+ }
99
+
100
+ li {
101
+ margin-top: var(--top-margin);
102
+ }
103
+
104
+ /* Code blocks */
105
+ pre {
106
+ padding: 0;
107
+ white-space: pre-wrap;
108
+ }
109
+
110
+ code {
111
+ font-family: "JetBrains Mono", "Consolas", "Ubuntu Mono", "DejaVu Sans Mono",
112
+ "Liberation Mono", "Courier New", monospace;
113
+ font-size: 1rem;
114
+ background-color: #eee;
115
+ padding-left: 0.4em;
116
+ padding-right: 0.4em;
117
+ display: inline-block;
118
+ border-radius: 0.3em;
119
+ line-height: 1.5;
120
+ }
121
+
122
+ h1 code,
123
+ h2 code,
124
+ h3 code,
125
+ h4 code,
126
+ h5 code {
127
+ font-size: 0.8em;
128
+ }
129
+
130
+ /* Quotes */
131
+ blockquote {
132
+ margin-top: var(--top-margin);
133
+ margin-left: var(--left-margin);
134
+ border-left: 4px solid #ccc;
135
+ padding-left: 0.5em;
136
+ color: #666;
137
+ }
138
+
139
+ blockquote > blockquote {
140
+ margin-left: var(--left-margin-small);
141
+ }
142
+
143
+ /* Figures */
144
+ img {
145
+ display: block;
146
+ margin: 2em auto 1em auto;
147
+ max-width: 80%;
148
+ }
149
+
150
+ /* -- Figure footer */
151
+ p > img + em {
152
+ text-align: center;
153
+ font-size: 1rem;
154
+ font-style: italic;
155
+ color: #666;
156
+ display: block;
157
+ margin: 1em auto 2em;
158
+ }
159
+
160
+ /* Tables */
161
+ table {
162
+ font-size: 1rem;
163
+ font-family: inherit;
164
+ border-collapse: collapse;
165
+ margin-top: var(--top-margin);
166
+ text-align: left;
167
+ table-layout: auto;
168
+ }
169
+
170
+ thead {
171
+ background-color: #eee;
172
+ }
173
+
174
+ tbody {
175
+ color: #666;
176
+ }
177
+
178
+ th,
179
+ td {
180
+ padding: 0.5em 0.75em;
181
+ border: 1px solid #ccc;
182
+ white-space: nowrap;
183
+ }
184
+
185
+ col {
186
+ width: auto;
187
+ }
188
+
189
+ /* Page breaks */
190
+ .pagebreak {
191
+ clear: both;
192
+ page-break-after: always;
193
+ }
194
+
195
+ .pagebreak + * {
196
+ margin-top: 0;
197
+ }
198
+
199
+ section,
200
+ ol,
201
+ ul,
202
+ table,
203
+ blockquote,
204
+ code,
205
+ p,
206
+ h1,
207
+ h2,
208
+ h3,
209
+ h4,
210
+ h5 {
211
+ page-break-inside: avoid;
212
+ }
213
+
214
+ /* Increase vertical padding for math elements with display=block */
215
+ math[display="block"] {
216
+ margin-top: 1em;
217
+ margin-bottom: 1em;
218
+ }
219
+
220
+ math {
221
+ text-rendering: optimizeLegibility;
222
+ font-family: "Latin Modern Math", "Cambria Math", serif;
223
+ }
@@ -16,8 +16,8 @@ OPTIONS_MODES = ("once", "live", "debug")
16
16
 
17
17
  MD_EXTENSIONS = {
18
18
  "fenced-code-blocks": None,
19
- "header-ids": None,
19
+ "header-ids": True,
20
20
  "breaks": {"on_newline": True},
21
- "tables": None,
21
+ "tables": True,
22
22
  "latex": True,
23
23
  }
@@ -4,6 +4,7 @@ Author: @julynx
4
4
  """
5
5
 
6
6
  import os
7
+ import re
7
8
  import time
8
9
  from datetime import datetime
9
10
  from pathlib import Path
@@ -11,60 +12,92 @@ from pathlib import Path
11
12
  import markdown2
12
13
  from playwright.sync_api import sync_playwright
13
14
 
14
- from .resources import get_css_path, get_code_css_path, get_output_path
15
- from .utils import drop_duplicates
16
15
  from .constants import MD_EXTENSIONS
16
+ from .resources import get_code_css_path, get_css_path, get_output_path
17
+ from .utils import drop_duplicates
17
18
 
18
19
 
19
- def _generate_pdf_with_playwright(html_content, output_path):
20
+ def _generate_pdf_with_playwright(
21
+ html_content,
22
+ output_path,
23
+ *,
24
+ css_content=None,
25
+ base_dir=None,
26
+ dump_html=False,
27
+ ):
20
28
  """
21
29
  Generate a PDF from HTML content using Playwright.
30
+
31
+ Args:
32
+ html_content (str): HTML content to convert.
33
+ output_path (str): Path to save the PDF file.
34
+ css_content (str, optional): CSS content to inject.
35
+ base_dir (Path, optional): Base directory for resolving relative paths in HTML.
36
+ dump_html (bool, optional): Whether to dump the HTML content to a file.
22
37
  """
23
38
  with sync_playwright() as p:
24
39
  browser = p.chromium.launch(headless=True)
25
40
  page = browser.new_page()
26
- page.set_content(html_content)
27
- # Wait for any potential resources to load
28
- page.wait_for_load_state("networkidle")
29
-
30
- pdf_params = {
31
- "format": "A4",
32
- "print_background": True,
33
- "margin": {
34
- "top": "20mm",
35
- "bottom": "20mm",
36
- "left": "20mm",
37
- "right": "20mm",
38
- },
39
- }
40
-
41
- if output_path:
42
- page.pdf(path=output_path, **pdf_params)
43
- browser.close()
44
- return None
45
41
 
46
- pdf_bytes = page.pdf(**pdf_params)
47
- browser.close()
48
- return pdf_bytes
42
+ # Handle loading based on presence of base_dir
43
+ temp_html = None
44
+ try:
45
+ if base_dir:
46
+ temp_html = base_dir / f".temp_{os.getpid()}.html"
47
+ temp_html.write_text(html_content, encoding="utf-8")
48
+ page.goto(temp_html.as_uri(), wait_until="networkidle")
49
+ else:
50
+ page.set_content(html_content, wait_until="networkidle")
51
+
52
+ if css_content:
53
+ page.add_style_tag(content=css_content)
54
+
55
+ pdf_params = {
56
+ "format": "A4",
57
+ "print_background": True,
58
+ "margin": {"top": "20mm", "bottom": "20mm", "left": "20mm", "right": "20mm"},
59
+ "path": output_path,
60
+ } # Playwright ignores None paths
61
+
62
+ pdf_bytes = page.pdf(**pdf_params)
63
+ return None if output_path else pdf_bytes
64
+
65
+ finally:
66
+ browser.close()
67
+ if temp_html and temp_html.exists() and not dump_html:
68
+ temp_html.unlink()
49
69
 
50
70
 
51
- def _embed_css_in_html(html, css_sources):
71
+ def _get_css_content(css_sources):
52
72
  """
53
- Embed CSS styles into HTML content.
73
+ Get the CSS content from a list of CSS file paths.
54
74
 
55
75
  Args:
56
- html (str): HTML content.
57
76
  css_sources (list): List of CSS file paths.
58
-
59
77
  Returns:
60
- HTML content with embedded CSS styles.
78
+ str: Combined CSS content.
61
79
  """
62
80
  css_buffer = ""
63
81
  for css_file in css_sources:
64
82
  css_buffer += Path(css_file).read_text(encoding="utf-8") + "\n"
83
+ return css_buffer
65
84
 
66
- style_tag = f"<style>\n{css_buffer}\n</style>\n"
67
- return f"<!DOCTYPE html>\n<html>\n<head>\n{style_tag}</head>\n<body>\n{html}\n</body>\n</html>"
85
+
86
+ def _create_sections(html):
87
+ """
88
+ Creates h2 sections, from the first h2 to the next h2, wrapping them in <section> tags
89
+ using regular expressions.
90
+ Args:
91
+ html (str): HTML content.
92
+ Returns:
93
+ HTML content with sections wrapped in <section> tags.
94
+ """
95
+ pattern = re.compile(r"(<h2.*?>.*?</h2>)(.*?)(?=(<h2.*?>|$))", re.DOTALL)
96
+
97
+ def wrap_section(match):
98
+ return f"<section>\n{match.group(1)}\n{match.group(2)}\n</section>\n"
99
+
100
+ return pattern.sub(wrap_section, html)
68
101
 
69
102
 
70
103
  def convert(
@@ -100,13 +133,15 @@ def convert(
100
133
 
101
134
  try:
102
135
  html = markdown2.markdown_path(md_path, extras=MD_EXTENSIONS)
103
- html = _embed_css_in_html(html, css_sources)
104
-
105
- if dump_html:
106
- html_dump_path = Path(output_path).with_suffix(".html")
107
- html_dump_path.write_text(html, encoding="utf-8")
108
-
109
- _generate_pdf_with_playwright(html, output_path)
136
+ html = _create_sections(html)
137
+
138
+ _generate_pdf_with_playwright(
139
+ html,
140
+ output_path,
141
+ css_content=_get_css_content(css_sources),
142
+ base_dir=Path(md_path).resolve().parent,
143
+ dump_html=dump_html,
144
+ )
110
145
 
111
146
  except Exception as exc:
112
147
  raise RuntimeError(exc) from exc
@@ -129,7 +164,11 @@ def live_convert(md_path, css_path=None, output_path=None, *, extend_default_css
129
164
  output_path = get_output_path(md_path, None)
130
165
 
131
166
  live_converter = LiveConverter(
132
- md_path, css_path, output_path, extend_default_css=extend_default_css, loud=True
167
+ md_path,
168
+ css_path,
169
+ output_path,
170
+ extend_default_css=extend_default_css,
171
+ loud=True,
133
172
  )
134
173
  live_converter.observe()
135
174
 
@@ -159,9 +198,13 @@ def convert_text(md_text, css_text=None, *, extend_default_css=True):
159
198
 
160
199
  try:
161
200
  html = markdown2.markdown(md_text, extras=MD_EXTENSIONS)
162
- html = _embed_css_in_html(html, css_sources)
201
+ html = _create_sections(html)
163
202
 
164
- return _generate_pdf_with_playwright(html, None)
203
+ return _generate_pdf_with_playwright(
204
+ html,
205
+ None,
206
+ css_content=_get_css_content(css_sources),
207
+ )
165
208
 
166
209
  except Exception as exc:
167
210
  raise RuntimeError(exc) from exc
@@ -172,9 +215,7 @@ class LiveConverter:
172
215
  Class to convert a markdown file to a pdf file and watch for changes.
173
216
  """
174
217
 
175
- def __init__(
176
- self, md_path, css_path, output_path, *, extend_default_css=True, loud=False
177
- ):
218
+ def __init__(self, md_path, css_path, output_path, *, extend_default_css=True, loud=False):
178
219
  """
179
220
  Initialize the LiveConverter class.
180
221
 
@@ -234,10 +275,7 @@ class LiveConverter:
234
275
  md_modified = self.get_last_modified_date(self.md_path)
235
276
  css_modified = self.get_last_modified_date(self.css_path)
236
277
 
237
- if (
238
- md_modified != self.md_last_modified
239
- or css_modified != self.css_last_modified
240
- ):
278
+ if md_modified != self.md_last_modified or css_modified != self.css_last_modified:
241
279
 
242
280
  self.write_pdf()
243
281
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "markdown_convert"
7
- version = "1.2.17"
7
+ version = "1.2.19"
8
8
  description = "Convert Markdown files to PDF from your command line."
9
9
  authors = [
10
10
  { name = "Julio Cabria", email = "juliocabria@tutanota.com" },
@@ -1,379 +0,0 @@
1
- /* Font imports */
2
- /* -- Cantarell Web */
3
- @font-face {
4
- font-family: "Cantarell Web";
5
- font-style: italic;
6
- font-weight: 400;
7
- font-display: swap;
8
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50LF7ZDq37KMUvlO015iZJnNKuiLA.woff2) format("woff2");
9
- unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
10
- U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
11
- }
12
-
13
- @font-face {
14
- font-family: "Cantarell Web";
15
- font-style: italic;
16
- font-weight: 400;
17
- font-display: swap;
18
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50LF7ZDq37KMUvlO015iZJpNKs.woff2) format("woff2");
19
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
20
- U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
21
- U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
22
- }
23
-
24
- @font-face {
25
- font-family: "Cantarell Web";
26
- font-style: italic;
27
- font-weight: 700;
28
- font-display: swap;
29
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50WF7ZDq37KMUvlO015iZrSEb6TDYsmgQ.woff2) format("woff2");
30
- unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
31
- U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
32
- }
33
-
34
- @font-face {
35
- font-family: "Cantarell Web";
36
- font-style: italic;
37
- font-weight: 700;
38
- font-display: swap;
39
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50WF7ZDq37KMUvlO015iZrSEb6dDYs.woff2) format("woff2");
40
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
41
- U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
42
- U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
43
- }
44
-
45
- @font-face {
46
- font-family: "Cantarell Web";
47
- font-style: normal;
48
- font-weight: 400;
49
- font-display: swap;
50
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50NF7ZDq37KMUvlO015gqJrLK8.woff2) format("woff2");
51
- unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
52
- U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
53
- }
54
-
55
- @font-face {
56
- font-family: "Cantarell Web";
57
- font-style: normal;
58
- font-weight: 400;
59
- font-display: swap;
60
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50NF7ZDq37KMUvlO015jKJr.woff2) format("woff2");
61
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
62
- U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
63
- U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
64
- }
65
-
66
- @font-face {
67
- font-family: "Cantarell Web";
68
- font-style: normal;
69
- font-weight: 700;
70
- font-display: swap;
71
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50IF7ZDq37KMUvlO01xN4d-HY6fFY8.woff2) format("woff2");
72
- unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
73
- U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
74
- }
75
-
76
- @font-face {
77
- font-family: "Cantarell Web";
78
- font-style: normal;
79
- font-weight: 700;
80
- font-display: swap;
81
- src: url(https://fonts.gstatic.com/s/cantarell/v17/B50IF7ZDq37KMUvlO01xN4d-E46f.woff2) format("woff2");
82
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
83
- U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
84
- U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
85
- }
86
-
87
- /* -- JetBrains Mono */
88
- @font-face {
89
- font-family: "JetBrains Mono";
90
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-Bold-Italic.woff2") format("woff2"),
91
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-Bold-Italic.woff") format("woff");
92
- font-weight: 700;
93
- font-style: italic;
94
- font-display: swap;
95
- }
96
-
97
- @font-face {
98
- font-family: "JetBrains Mono";
99
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-Bold.woff2") format("woff2"),
100
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-Bold.woff") format("woff");
101
- font-weight: 700;
102
- font-style: normal;
103
- font-display: swap;
104
- }
105
-
106
- @font-face {
107
- font-family: "JetBrains Mono";
108
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-ExtraBold-Italic.woff2") format("woff2"),
109
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-ExtraBold-Italic.woff") format("woff");
110
- font-weight: 800;
111
- font-style: italic;
112
- font-display: swap;
113
- }
114
-
115
- @font-face {
116
- font-family: "JetBrains Mono";
117
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-ExtraBold.woff2") format("woff2"),
118
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-ExtraBold.woff") format("woff");
119
- font-weight: 800;
120
- font-style: normal;
121
- font-display: swap;
122
- }
123
-
124
- @font-face {
125
- font-family: "JetBrains Mono";
126
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-Italic.woff2") format("woff2"),
127
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-Italic.woff") format("woff");
128
- font-weight: 400;
129
- font-style: italic;
130
- font-display: swap;
131
- }
132
-
133
- @font-face {
134
- font-family: "JetBrains Mono";
135
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-Medium-Italic.woff2") format("woff2"),
136
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-Medium-Italic.woff") format("woff");
137
- font-weight: 500;
138
- font-style: italic;
139
- font-display: swap;
140
- }
141
-
142
- @font-face {
143
- font-family: "JetBrains Mono";
144
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-Medium.woff2") format("woff2"),
145
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-Medium.woff") format("woff");
146
- font-weight: 500;
147
- font-style: normal;
148
- font-display: swap;
149
- }
150
-
151
- @font-face {
152
- font-family: "JetBrains Mono";
153
- src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-Regular.woff2") format("woff2"),
154
- url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-Regular.woff") format("woff");
155
- font-weight: 400;
156
- font-style: normal;
157
- font-display: swap;
158
- }
159
-
160
- /* Print media css */
161
- @page {
162
- size: A4;
163
- margin: 2.54cm;
164
- }
165
-
166
- :root {
167
- /* -- Standard margins */
168
- --top-margin: 1em;
169
- --left-margin: 1.5em;
170
-
171
- /* -- Small margins */
172
- --left-margin-small: 1em;
173
-
174
- /* -- Big margins */
175
- --left-margin-big: 2em;
176
- --bottom-margin-big: 0.5em;
177
- }
178
-
179
- /* Document */
180
- html {
181
- font-size: 10px;
182
- }
183
-
184
- body {
185
- margin: 0;
186
- padding: 0;
187
- font-family: "Cantarell Web", "Cantarell", sans-serif;
188
- color: #333;
189
- }
190
-
191
- /* Headers and paragraphs */
192
- h1,
193
- h2,
194
- h3,
195
- h4,
196
- h5 {
197
- color: #333;
198
- font-weight: 400;
199
- }
200
-
201
- h1 {
202
- margin-top: 0;
203
- margin-bottom: var(--bottom-margin-big);
204
- }
205
-
206
- h2,
207
- h3,
208
- h4,
209
- h5,
210
- p {
211
- margin-top: var(--top-margin);
212
- margin-bottom: 0;
213
- }
214
-
215
- h1 {
216
- font-size: 4.8rem;
217
- }
218
-
219
- h2 {
220
- font-size: 3.6rem;
221
- }
222
-
223
- h3 {
224
- font-size: 2.4rem;
225
- }
226
-
227
- h4 {
228
- font-size: 1.8rem;
229
- }
230
-
231
- h5 {
232
- font-size: 1.4rem;
233
- }
234
-
235
- p {
236
- font-size: 1.2rem;
237
- }
238
-
239
- /* Links */
240
- a {
241
- color: #09f;
242
- margin: 0;
243
- vertical-align: baseline;
244
- }
245
-
246
- /* Lists */
247
- ul,
248
- ol {
249
- font-size: 1.2rem;
250
- padding: 0;
251
- margin-top: var(--top-margin);
252
- margin-right: 0;
253
- margin-bottom: var(--bottom-margin);
254
- margin-left: var(--left-margin-big);
255
- }
256
-
257
- ul ol,
258
- ol ul,
259
- ol ol,
260
- ul ul {
261
- margin-top: 0;
262
- }
263
-
264
- li {
265
- margin-top: 0.5rem;
266
- }
267
-
268
- /* Code blocks */
269
- pre {
270
- padding: 0;
271
- white-space: pre-wrap;
272
- }
273
-
274
- code {
275
- font-family: "JetBrains Mono", "Courier New", Courier, monospace;
276
- font-size: 1rem;
277
- background-color: #eee;
278
- padding-left: 0.4em;
279
- padding-right: 0.4em;
280
- display: inline-block;
281
- border-radius: 0.3em;
282
- line-height: 1.5;
283
- }
284
-
285
- h1 code,
286
- h2 code,
287
- h3 code,
288
- h4 code,
289
- h5 code {
290
- font-size: 0.8em;
291
- }
292
-
293
- /* Quotes */
294
- blockquote {
295
- margin-top: var(--top-margin);
296
- margin-left: var(--left-margin);
297
- max-width: 30em;
298
- border-left: 4px solid #ccc;
299
- padding-left: 0.5em;
300
- color: #666;
301
- }
302
-
303
- blockquote>blockquote {
304
- margin-left: var(--left-margin-small);
305
- }
306
-
307
- /* Figures */
308
- img {
309
- display: block;
310
- margin: 2em auto 1em auto;
311
- max-width: 80%;
312
- }
313
-
314
- /* -- Figure footer */
315
- p>img+em {
316
- text-align: center;
317
- font-size: 1rem;
318
- font-style: italic;
319
- color: #666;
320
- display: block;
321
- margin: 1em auto 2em;
322
- }
323
-
324
- /* Tables */
325
- table {
326
- font-size: 1rem;
327
- border-collapse: collapse;
328
- margin-top: var(--top-margin);
329
- text-align: left;
330
- table-layout: auto;
331
- }
332
-
333
- thead {
334
- background-color: #eee;
335
- }
336
-
337
- tbody {
338
- color: #666;
339
- }
340
-
341
- th,
342
- td {
343
- padding: 0.5em 0.75em;
344
- border: 1px solid #ccc;
345
- white-space: nowrap;
346
- }
347
-
348
- col {
349
- width: auto;
350
- }
351
-
352
- /* Page breaks */
353
- .pagebreak {
354
- clear: both;
355
- page-break-after: always;
356
- }
357
-
358
- .pagebreak+* {
359
- margin-top: 0;
360
- }
361
-
362
- li,
363
- table,
364
- blockquote,
365
- code,
366
- p,
367
- h1,
368
- h2,
369
- h3,
370
- h4,
371
- h5 {
372
- page-break-inside: avoid;
373
- }
374
-
375
- /* Increase vertical padding for math elements with display=block */
376
- math[display="block"] {
377
- margin-top: 1em;
378
- margin-bottom: 1em;
379
- }