Why?
I want to write a simple article using an editor that seamlessly renders as I type, and control typographical details.
Example
Write main.md
:
```{=typst}
// typst here
#import "template.typ": project
#show: project.with(…)
```
# Heading
markdown here.
```{=typst}
#figure(
table(…), // some complex table
caption: […],
) <tab>
```
You can reference the figure as `@tab`{=typst}.
Convert it to main.typ
by running pandoc main.md --from markdown+raw_attribute --output main.typ
. ( pandoc.org/try.)
// typst here
#import "template.typ": project
#show: project.with(…)
= Heading
<heading>
markdown here.
#figure(
table(…), // some complex table
caption: […],
) <tab>
You can reference the figure as @tab.
Then typst compile main.typ
.
Additional information
-
Refer to pandoc doc on the
raw_attribute
extension. -
Get rid of auxiliary files by leveraging
-
(stdin/stdout):pandoc main.md --from markdown+raw_attribute --output - --to typst \ | typst compile - main.pdf
(Typst is so fast that it is not really necessary to
typst watch
for simple documents.)