Skip to content

Commit

Permalink
feat: allow including external code snippets (#328)
Browse files Browse the repository at this point in the history
This allows adding snippets that pull in an external source file.
Attributes still work like you'd expect. Examples:

A rust file that allows execution:
~~~
```file +exec +line_numbers
path: snippet.rs
language: rust
```
~~~

A mermaid script that is rendered like you'd expect
~~~
```file +render
path: snippet.mmd
language: mermaid
```
~~~

Relates to #307
  • Loading branch information
mfontanini authored Aug 4, 2024
2 parents d221b0a + 39782d0 commit 322fad6
Show file tree
Hide file tree
Showing 11 changed files with 722 additions and 679 deletions.
2 changes: 1 addition & 1 deletion src/custom.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
input::user::KeyBinding,
markdown::elements::SnippetLanguage,
media::{emulator::TerminalEmulator, kitty::KittyMode},
processing::code::SnippetLanguage,
GraphicsMode,
};
use clap::ValueEnum;
Expand Down
4 changes: 2 additions & 2 deletions src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::{
custom::LanguageSnippetExecutionConfig,
markdown::elements::{Snippet, SnippetLanguage},
processing::code::{Snippet, SnippetLanguage},
};
use once_cell::sync::Lazy;
use os_pipe::PipeReader;
Expand Down Expand Up @@ -244,7 +244,7 @@ impl ProcessStatus {
#[cfg(test)]
mod test {
use super::*;
use crate::markdown::elements::SnippetAttributes;
use crate::processing::code::SnippetAttributes;

#[test]
fn shell_code_execution() {
Expand Down
297 changes: 0 additions & 297 deletions src/markdown/code.rs

This file was deleted.

Loading

0 comments on commit 322fad6

Please sign in to comment.