Struct notedown_ast::nodes::CodeNode
source · [−]pub struct CodeNode {
pub inline: bool,
pub highlight: bool,
pub language: String,
pub code: String,
pub show_file_name: Option<String>,
pub show_line_number: Option<usize>,
pub highlight_lines: Vec<RangeInclusive<usize>>,
pub hide_lines: Vec<RangeInclusive<usize>>,
}Expand description
Code Block
Code Inline
Code block in the body
text `code` textCode Block
Independent code block
```lang
some code
following code
another code
```
// You can also add additional parameters
```lang {
key = args
}
some code
following code
another code
```Fields
inline: boolhighlight: boollanguage: Stringcode: Stringshow_file_name: Option<String>show_line_number: Option<usize>None means not show line_number usize means starts with n
highlight_lines: Vec<RangeInclusive<usize>>hide_lines: Vec<RangeInclusive<usize>>Implementations
sourceimpl CodeNode
impl CodeNode
sourcepub fn set_file_name(self, name: String) -> Self
pub fn set_file_name(self, name: String) -> Self
Set file name of the code segment
sourcepub fn clear_highlight_line(self) -> Self
pub fn clear_highlight_line(self) -> Self
Clear highlight info
sourcepub fn set_highlight_line(self, lines: Vec<RangeInclusive<usize>>) -> Self
pub fn set_highlight_line(self, lines: Vec<RangeInclusive<usize>>) -> Self
Set highlight info
sourcepub fn add_highlight_line(self, line: usize) -> Self
pub fn add_highlight_line(self, line: usize) -> Self
Add highlight line
sourcepub fn add_highlight_range(self, lines: RangeInclusive<usize>) -> Self
pub fn add_highlight_range(self, lines: RangeInclusive<usize>) -> Self
Add highlight line ranged
sourceimpl CodeNode
impl CodeNode
sourcepub fn code_inline(code: String) -> Self
pub fn code_inline(code: String) -> Self
`s`sourcepub fn code_block(lang: String, code: String) -> Self
pub fn code_block(lang: String, code: String) -> Self
`s`Trait Implementations
sourceimpl IntoASTNode for CodeNode
impl IntoASTNode for CodeNode
sourcefn into_node(self, range: MaybeRanged) -> ASTNode
fn into_node(self, range: MaybeRanged) -> ASTNode
Convert element into
ASTNode with positionimpl Eq for CodeNode
impl StructuralEq for CodeNode
impl StructuralPartialEq for CodeNode
Auto Trait Implementations
impl RefUnwindSafe for CodeNode
impl Send for CodeNode
impl Sync for CodeNode
impl Unpin for CodeNode
impl UnwindSafe for CodeNode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.