Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semicolon swallowed after link with org mode input and typst as pdf engine #9252

Closed
egh opened this issue Dec 14, 2023 · 5 comments
Closed
Labels

Comments

@egh
Copy link

egh commented Dec 14, 2023

org_semicolon_typst.txt

Explain the problem.

A semicolon after a link seems to be swallowed somehow when outputting pdf with typst.

$ mv org_semicolon_typst.txt org_semicolon_typst.org
$ pandoc org_semicolon_typst.org -o out.pdf --pdf-engine typst

Outputs: out.pdf
Pandoc version?

$ pandoc --version
pandoc 3.1.10
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/egh/.pandoc
Copyright (C) 2006-2023 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
@egh egh added the bug label Dec 14, 2023
@jgm
Copy link
Owner

jgm commented Dec 14, 2023

From this input, pandoc produces the following typst output:

== Foo
<foo>
- #link("http://example.org")[foo]; bar

The semicolon is there. So, this seems to be a feature (or bug) of typst? You should consult with typst experts, probably, to figure out what is happening.

@egh
Copy link
Author

egh commented Dec 14, 2023

Thank you for looking into this. I will file an upstream bug.

@egh
Copy link
Author

egh commented Dec 14, 2023

This seems to be intended behavior in typst. See https://typst.app/docs/reference/scripting/#expressions

In Typst, markup and code are fused into one. All but the most common elements are created with functions. To make this as convenient as possible, Typst provides compact syntax to embed a code expression into markup: An expression is introduced with a hash (#) and normal markup parsing resumes after the expression is finished. If a character would continue the expression but should be interpreted as text, the expression can forcibly be ended with a semicolon (;).

I asked about this here: typst/typst#2960 (reply in thread)

So I think pandoc needs to "forcibly" end the expression with a semicolon.

@jgm
Copy link
Owner

jgm commented Dec 14, 2023

Oh, of course. I think I'll just produce it whenever we have inline code, to be safe.

@jgm jgm closed this as completed in fd73880 Dec 14, 2023
@egh
Copy link
Author

egh commented Dec 14, 2023

Thank you for the very quick fix!

jgm added a commit that referenced this issue Jan 29, 2024
We no longer escape `(`. The reason we did this before (#9137)
has been addressed in another way (#9252).

We only escape `=`, `+`, `-` at the beginning of a line.

We now also escape `/` at the beginning of a line.

This should reduce unnecessary escapes.

Closes #9386.
jgm added a commit that referenced this issue Jan 29, 2024
We no longer escape `(`. The reason we did this before (#9137)
has been addressed in another way (#9252).

We only escape `=`, `+`, `-` at the beginning of a line.

We now also escape `/` at the beginning of a line.

This should reduce unnecessary escapes.

Closes #9386.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants