Adds support for executing Scala code snippets. Note that it works with
Scala 3, not Scala 2.
I spent some time trying to add an alternative executor for Scala 2,
doing a `scalac` to compile and a `scala` to execute. I could get it to
work if the class in the snippet was called `Snippet`, which seems like
an esoteric restriction. So I gave up on Scala 2.
This adds a `+env:<path>` snippet attribute that allows passing in an
env file to a snippet. This can be used both for the script itself _and_
the executor. e.g. this:
~~~markdown
```bash +exec +env:my_env
echo "$FOO"
```
~~~
With an `my_env` file in the presentation's directory with:
```
FOO=42
```
Will print "42". The env file can contain empty lines and lines starting
with "#" which will be ignored, otherwise any other lines must have a
format like `<VAR_NAME>=<VALUE>`.
Relates to #882
I noticed that if you open a HTML slide export on a mobile device, you
can't progress the slide content, because there's no tap/touch and swipe
support.
I've updated the script to do this, and also updated the export code to
not require a TTY to run, choosing some defaults targeted towards a 13"
laptop display, but that work well in landscape mode on mobile devices.
I also fixed a bug where you might get an error like this in the browser
console when trying to load the slide content from a file on disk
instead of from a web server:
```
presenterm-demo.html#slide-2:1 Unsafe attempt to load URL file:///private/tmp/presenterm-demo.html#slide-2 from frame with URL file:///private/tmp/presenterm-demo.html#slide-2. 'file:' URLs are treated as unique security origins.
```
1600x900
<img width="3200" height="1800" alt="1600_900"
src="https://github.com/user-attachments/assets/198c5a82-cdc3-4ba7-bc06-29b4232f7aa1"
/>
iPhone 12 Pro
<img width="2532" height="1170" alt="iphone_12_pro"
src="https://github.com/user-attachments/assets/94cb3b09-49d5-4a3f-941d-9934793e5d2b"
/>
Pixel 7
<img width="2402" height="1081" alt="pixel_7"
src="https://github.com/user-attachments/assets/84e9ef49-19c5-477f-aa0e-dda370b5bc31"
/>
## Summary
- Adds missing languages to the code highlighting table in
`docs/src/features/code/highlighting.md`: `dart`, `gdscript`, `graphql`,
`jsonnet`, `powershell`, `racket`, `rust-script`, `typst`, `verilog`,
and `wsl`. These are all already registered in `SnippetLanguage` and
recognized by the parser but were absent from the docs.
- Updates stale execution-support columns for `elixir`, `cmd`,
`typescript`, and `tsx`, which all have entries in `executors.yaml` but
were not marked as supporting execution.
- Renames the `batchfile` row to `cmd` since the parser only accepts
`bat`/`cmd`, and adds a `tsx` row alongside `typescript`.
## Test plan
- [x] `git diff` review of the updated table
- [x] Verified rendered table via GitHub's markdown preview of
`docs/src/features/code/highlighting.md` (equivalent to mdBook's
rendering for a pure-table edit)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
This makes presenterm respect alignments in tables (e.g. by using
`:-----` or `:-----:` or `-----:` in markdown tables). Since now we
support alignment, the table headings are now center aligned because it
looks better. Rows are still left aligned by default which seems to be
the default.
Closes#854
This allows selective highlighting to work on exports as long as there's
a single group. e.g. using `{3}` works, but not if using `{3|5}`. This
should have been the intended behavior so I'm considering this a fix.
Fixes#874
Typst blocks fall through to the `txt` extension in
`highlighting.rs`, so listing typst under the highlighted-languages
table is misleading. Properly highlighting typst would require a
source change and is out of scope for this docs refresh.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Addresses review feedback on #878:
- Rename the `batchfile` row to `cmd`, since `SnippetLanguage::from_str`
only accepts `bat`/`cmd`, not `batchfile`.
- Add a `tsx` row alongside `typescript` — `TypeScriptReact` has both a
highlighter and an executor entry.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The highlighting docs table was missing several languages that are
already wired up in the code (dart, gdscript, graphql, jsonnet,
powershell, racket, rust-script, typst, verilog, wsl) and had stale
execution-support columns for elixir, batchfile, and typescript.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This allows configuring the mermaid tool to use since some users are
having issues with `mmdc` in the latest chrome version. I've verified
using https://github.com/coolamit/mermaid-cli/ works at least for a
couple of basic diagrams. Config is:
```yaml
mermaid:
cli: mmd-cli
```
Closes#865
This adds support for margins in between columns for column layouts via
the `column_layout.margin` property. This uses the `fixed` and `percent`
subkeys like other margins and indicates the number of empty (terminal)
columns to add in between columns in a layout.
Closes#859
This adds support for incremental tables just like `incremental_lists`
works: using an `incremental_tables` comment
command or a `options.incremental_tables` parameter.
Just like incremental lists, the default is to add a pause by default
before and after the table, but this can be
configured via the `incremental_tables.pause_before` and `.pause_after`
parameters.
Closes#855
This is a pretty 💩 fix but it works. In the future the way
margins are handled should be changed so we can say "draw this at the
top level", providing the operations we want to run there. The current
push/pop margin strategy is not great and leads to repetition and
issues.
Fixes#844
Out of interest, I tried to style the title, and it worked! I've updated
the docs to reflect this.
Interestingly, I couldn't get `italic: true` to work, though bold and
underline were fine.
Out of interest, I tried to style the title, and it worked! I've updated the docs to reflect this.
Interestingly, I couldn't get `italic: true` to work, though bold and underline were fine.
I've found the function `should_ignore_comment` and have been relying on
it to add user comments inside presentations by abusing the `<!-- vim:
comment here -->` since I don't use vim for this anyways.
This isn't clean and a dedicated way to comment should be added IMO.
Also, there is an issue with the hacky vim solution above, it adds a
newline where the comment should be ignored; fixed by using
`self.slide_state.ignore_element_line_break = true` on ignored comments.
Current comments:
<img width="770" height="465" alt="image"
src="https://github.com/user-attachments/assets/f0a3aa41-1b90-463f-917b-416731b8a207"
/>
PR with ignore line breaks:
<img width="751" height="414" alt="image"
src="https://github.com/user-attachments/assets/f242463e-51f2-45f1-a5a1-69b014175d41"
/>