Struct obsidian_export::Exporter
source · pub struct Exporter<'a> { /* private fields */ }
Expand description
Exporter provides the main interface to this library.
Users are expected to create an Exporter using Exporter::new
, optionally followed by
customization using Exporter::frontmatter_strategy
and Exporter::walk_options
.
After that, calling Exporter::run
will start the export process.
Implementations§
source§impl<'a> Exporter<'a>
impl<'a> Exporter<'a>
sourcepub fn new(root: PathBuf, destination: PathBuf) -> Exporter<'a>
pub fn new(root: PathBuf, destination: PathBuf) -> Exporter<'a>
Create a new exporter which reads notes from root
and exports these to
destination
.
sourcepub fn start_at(&mut self, start_at: PathBuf) -> &mut Exporter<'a>
pub fn start_at(&mut self, start_at: PathBuf) -> &mut Exporter<'a>
Set a custom starting point for the export.
Normally all notes under root
(except for notes excluded by ignore rules) will be exported.
When start_at
is set, only notes under this path will be exported to the target destination.
sourcepub fn walk_options(&mut self, options: WalkOptions<'a>) -> &mut Exporter<'a>
pub fn walk_options(&mut self, options: WalkOptions<'a>) -> &mut Exporter<'a>
Set the WalkOptions
to be used for this exporter.
sourcepub fn frontmatter_strategy(
&mut self,
strategy: FrontmatterStrategy
) -> &mut Exporter<'a>
pub fn frontmatter_strategy( &mut self, strategy: FrontmatterStrategy ) -> &mut Exporter<'a>
Set the FrontmatterStrategy
to be used for this exporter.
sourcepub fn process_embeds_recursively(
&mut self,
recursive: bool
) -> &mut Exporter<'a>
pub fn process_embeds_recursively( &mut self, recursive: bool ) -> &mut Exporter<'a>
Set the behavior when recursive embeds are encountered.
When recursive
is true (the default), emdeds are always processed recursively. This may
lead to infinite recursion when note A embeds B, but B also embeds A.
(When this happens, ExportError::RecursionLimitExceeded will be returned by Exporter::run).
When recursive
is false, if a note is encountered for a second time while processing the
original note, instead of embedding it again a link to the note is inserted instead.
sourcepub fn add_postprocessor(
&mut self,
processor: &'a Postprocessor<'_>
) -> &mut Exporter<'a>
pub fn add_postprocessor( &mut self, processor: &'a Postprocessor<'_> ) -> &mut Exporter<'a>
Append a function to the chain of postprocessors to run on exported Obsidian Markdown notes.
sourcepub fn add_embed_postprocessor(
&mut self,
processor: &'a Postprocessor<'_>
) -> &mut Exporter<'a>
pub fn add_embed_postprocessor( &mut self, processor: &'a Postprocessor<'_> ) -> &mut Exporter<'a>
Append a function to the chain of postprocessors for embeds.
sourcepub fn run(&mut self) -> Result<(), ExportError>
pub fn run(&mut self) -> Result<(), ExportError>
Export notes using the settings configured on this exporter.