-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🍣 Add raw directives/roles for inserting tex/typst-specific content (#…
…1442) Co-authored-by: Rowan Cockett <rowanc1@gmail.com>
- Loading branch information
Showing
17 changed files
with
320 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'myst-directives': patch | ||
'myst-spec-ext': patch | ||
'myst-to-typst': patch | ||
'myst-to-tex': patch | ||
'myst-roles': patch | ||
'myst-cli': patch | ||
--- | ||
|
||
Add raw directives/roles for inserting tex/typst-specific content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { RoleSpec } from 'myst-common'; | ||
import type { Raw } from 'myst-spec-ext'; | ||
|
||
export const rawLatexRole: RoleSpec = { | ||
name: 'raw:latex', | ||
alias: ['raw:tex'], | ||
doc: 'Allows you to include tex in your document that will only be included in tex exports', | ||
body: { | ||
type: String, | ||
doc: 'Raw tex content', | ||
}, | ||
run(data): Raw[] { | ||
const lang = 'tex'; | ||
const tex = (data.body as string) ?? ''; | ||
return [ | ||
{ | ||
type: 'raw', | ||
lang, | ||
tex, | ||
}, | ||
]; | ||
}, | ||
}; | ||
|
||
export const rawTypstRole: RoleSpec = { | ||
name: 'raw:typst', | ||
alias: ['raw:typ'], | ||
doc: 'Allows you to include typst in your document that will only be included in typst exports', | ||
body: { | ||
type: String, | ||
doc: 'Raw typst content', | ||
}, | ||
run(data): Raw[] { | ||
const lang = 'typst'; | ||
const typst = (data.body as string) ?? ''; | ||
return [ | ||
{ | ||
type: 'raw', | ||
lang, | ||
typst, | ||
}, | ||
]; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# MyST build outputs | ||
/_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Project with raw content | ||
|
||
This has raw {raw:tex}`LaTeX`{raw:typst}`Typst` content | ||
|
||
```{raw:latex} | ||
\section{LaTeX Heading} | ||
``` | ||
```{raw:typ} | ||
= Typst Heading | ||
``` | ||
|
||
```{raw} | ||
This is *just text* | ||
``` | ||
|
||
```{raw} latex | ||
This is \textit{latex} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# See docs at: https://mystmd.org/guide/frontmatter | ||
version: 1 | ||
project: | ||
author: Franklin Koch | ||
date: 9 Aug 2024 | ||
exclude: outputs | ||
exports: | ||
- output: _build/out.tex | ||
template: null | ||
- output: _build/out.typ | ||
template: null | ||
site: | ||
template: ../templates/site/myst/book-theme | ||
# options: | ||
# favicon: favicon.ico | ||
# logo: site_logo.png |
Oops, something went wrong.