Skip to content

Commit 5dd1ae8

Browse files
authored
Mermaid improvements (#1087)
* update output formats for mermaid * update changelog
1 parent 75fa7ba commit 5dd1ae8

File tree

6 files changed

+53
-9
lines changed

6 files changed

+53
-9
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change
99

1010
## [Unreleased]
1111

12+
### Added
13+
14+
- Support for Kotlin programming language in activecode. (core)
15+
- Improvements for Mermaid image generation. (core)
16+
- Image descriptions now work on Asymptote images. (core)
17+
18+
### Changed
19+
20+
- Display math can be placed inside `<md>` (without `<mrow>`) instead of `<me>`. Numbered equations now specified with an attribute. (core)
21+
1222
### Fixed
1323

1424
- Bug that sometimes prevented `pretext view` from working due to permissions on mac.
1525
- Typos in template publication files.
1626
- Default output filename for the slideshow template is now `index.html` so `pretext view` will open directly to the slideshow.
27+
- Bug that sometimes prevented a journal article style file from being downloaded.
1728

1829
## [2.30.2] - 2025-11-11
1930

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
INFO : Since no target was supplied, we will use "slides".
2+
3+
INFO : Now preparing local server to preview your project directory `/files/GitHub/dev/pretext-cli/new-pretext-project`.
4+
INFO : (Reminder: use `pretext deploy` to deploy your built project to a public
5+
INFO : GitHub Pages site that can be shared with readers who cannot access your
6+
INFO : personal computer.)
7+
INFO :
8+
INFO : starting server ...
9+
INFO : setting up PreTeXt web server ...
10+
INFO : Added pretext web server entry 32a890857c 528346 8128 localhost
11+
12+
INFO : Server will soon be available at http://localhost:8128
13+
INFO : Opening browser for target `slides` at http://localhost:8128/output/slides
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
INFO : Since no target was supplied, we will use "slides".
2+
3+
INFO : Now preparing local server to preview your project directory `/files/GitHub/dev/pretext-cli/new-pretext-project`.
4+
INFO : (Reminder: use `pretext deploy` to deploy your built project to a public
5+
INFO : GitHub Pages site that can be shared with readers who cannot access your
6+
INFO : personal computer.)
7+
INFO :
8+
INFO : starting server ...
9+
INFO : setting up PreTeXt web server ...
10+
INFO : Added pretext web server entry 32a890857c 528769 8129 localhost
11+
12+
INFO : Server will soon be available at http://localhost:8129
13+
INFO : Opening browser for target `slides` at http://localhost:8129/output/slides

pretext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
VERSION = get_version("pretext", Path(__file__).parent.parent)
2020

2121

22-
CORE_COMMIT = "ad3ef3fb102bf393b9fe33ecb242848e5ca6b0df"
22+
CORE_COMMIT = "65231d1891e6a60f9e9d4873520e5d3e849e59b3"
2323

2424

2525
def activate() -> None:

pretext/constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,14 @@
170170
"latex-image": [],
171171
"sageplot": ["pdf", "png"],
172172
"prefigure": ["pdf"],
173+
"mermaid": ["png"],
173174
},
174175
"latex": {
175176
"asymptote": ["pdf"],
176177
"latex-image": [],
177178
"sageplot": ["pdf", "png"],
178179
"prefigure": ["pdf"],
180+
"mermaid": ["png"],
179181
},
180182
"html": {
181183
"asymptote": ["html"],
@@ -194,12 +196,14 @@
194196
"latex-image": ["svg"],
195197
"sageplot": ["svg"],
196198
"prefigure": ["svg"],
199+
"mermaid": ["svg"],
197200
},
198201
"kindle": {
199202
"asymptote": ["png"],
200203
"latex-image": ["png"],
201204
"sageplot": ["png"],
202205
"prefigure": ["png"],
206+
"mermaid": ["svg"],
203207
},
204208
"braille": {
205209
"asymptote": ["all"],
@@ -222,6 +226,7 @@
222226
"latex-image": ["all"],
223227
"sageplot": ["all"],
224228
"prefigure": ["all"],
229+
"mermaid": ["png", "svg"],
225230
},
226231
}
227232

pretext/project/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,14 +1190,16 @@ def generate_assets(
11901190
log.debug(e, exc_info=True)
11911191
if "mermaid" in assets_to_generate:
11921192
try:
1193-
core.mermaid_images(
1194-
xml_source=self.source_abspath(),
1195-
pub_file=self.publication_abspath().as_posix(),
1196-
stringparams=stringparams_copy,
1197-
xmlid_root=xmlid,
1198-
dest_dir=self.generated_dir_abspath() / "mermaid",
1199-
)
1200-
successful_assets.append("mermaid")
1193+
for outformat in asset_formats["mermaid"]:
1194+
core.mermaid_images(
1195+
xml_source=self.source_abspath(),
1196+
pub_file=self.publication_abspath().as_posix(),
1197+
stringparams=stringparams_copy,
1198+
xmlid_root=xmlid,
1199+
dest_dir=self.generated_dir_abspath() / "mermaid",
1200+
outformat=outformat,
1201+
)
1202+
successful_assets.append("mermaid")
12011203
except Exception as e:
12021204
log.error(f"Unable to generate some mermaid images: \n{e}")
12031205
log.debug(e, exc_info=True)

0 commit comments

Comments
 (0)