mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 02:08:17 +00:00
feat: embed Markdown codes (#1296)
* feat: directly output raw language 'typlite' * docs: raw output
This commit is contained in:
parent
b24a7fd497
commit
33df227b17
2 changed files with 16 additions and 0 deletions
|
@ -10,3 +10,7 @@ typlite main.typ
|
|||
# specify output
|
||||
typlite main.typ output.md
|
||||
```
|
||||
|
||||
## Feature
|
||||
|
||||
- **Raw Output**: Raw codes with `typlite` language will be directly output into the Markdown result.
|
||||
|
|
|
@ -582,6 +582,18 @@ impl TypliteWorker {
|
|||
fn raw(node: &SyntaxNode) -> Result<Value> {
|
||||
let mut s = EcoString::new();
|
||||
let raw = node.cast::<ast::Raw>().unwrap();
|
||||
|
||||
// Raw codes with typlite language will not be treated as a code block but directly output into the Markdown result.
|
||||
if let Some(lang) = raw.lang() {
|
||||
if &EcoString::from("typlite") == lang.get() {
|
||||
for line in raw.lines() {
|
||||
s.push_str(&Self::value(Self::str(line.to_untyped())?));
|
||||
s.push('\n');
|
||||
}
|
||||
return Ok(Value::Content(s));
|
||||
}
|
||||
}
|
||||
|
||||
if raw.block() {
|
||||
s.push_str(&Self::value(Self::str(node)?));
|
||||
return Ok(Value::Content(s));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue