Skip to main content

MD2Src

Struct MD2Src 

Source
pub struct MD2Src;
Expand description

Markdown to source code

Implementations§

Source§

impl MD2Src

Source

pub fn get_snippets_from_string( &self, markdown: String, lang: String, ignore: Vec<String>, ) -> Result<Vec<String>, ExitFailure>

Returns a vector of extracted code snippets.

§Arguments
  • markdown - The markdown string
  • lang - The language of the code snippets defined after three backticks
  • ignore - Ignore those code snippets that include this string
Source

pub fn get_snippets_from_file( &self, file: String, lang: String, ignore: Vec<String>, ) -> Result<Vec<String>, ExitFailure>

Returns a vector of extracted code snippets.

§Arguments
  • file - The markdown filename
  • lang - The language of the code snippets defined after three backticks
  • ignore - Ignore those code snippets that include this string
Source

pub fn write_snippets( &self, snippets: Vec<String>, folder: String, prefix: String, ext: String, ) -> Result<(), ExitFailure>

Writes a vector of extracted code snippets (each snippet one file: folder/prefix000.ext).

§Arguments
  • snippets - The extracted code snippets.
  • folder - The target folder for the code files.
  • prefix - The prefix of the code files.
  • ext - The extension of the code files.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.