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) -> Self
pub fn new(root: PathBuf, destination: PathBuf) -> Self
Create a new exporter which reads notes from root
and exports these to
destination
.
Sourcepub fn start_at(&mut self, start_at: PathBuf) -> &mut Self
pub fn start_at(&mut self, start_at: PathBuf) -> &mut Self
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 Self
pub fn walk_options(&mut self, options: WalkOptions<'a>) -> &mut Self
Set the WalkOptions
to be used for this exporter.
Sourcepub fn frontmatter_strategy(
&mut self,
strategy: FrontmatterStrategy,
) -> &mut Self
pub fn frontmatter_strategy( &mut self, strategy: FrontmatterStrategy, ) -> &mut Self
Set the FrontmatterStrategy
to be used for this exporter.
Sourcepub fn process_embeds_recursively(&mut self, recursive: bool) -> &mut Self
pub fn process_embeds_recursively(&mut self, recursive: bool) -> &mut Self
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 preserve_mtime(&mut self, preserve: bool) -> &mut Self
pub fn preserve_mtime(&mut self, preserve: bool) -> &mut Self
Set whether the modified time of exported files should be preserved.
When preserve
is true, the modified time of exported files will be set to the modified
time of the source file.
Sourcepub fn add_postprocessor(
&mut self,
processor: &'a Postprocessor<'_>,
) -> &mut Self
pub fn add_postprocessor( &mut self, processor: &'a Postprocessor<'_>, ) -> &mut Self
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 Self
pub fn add_embed_postprocessor( &mut self, processor: &'a Postprocessor<'_>, ) -> &mut Self
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.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Exporter<'a>
impl<'a> !RefUnwindSafe for Exporter<'a>
impl<'a> Send for Exporter<'a>
impl<'a> Sync for Exporter<'a>
impl<'a> Unpin for Exporter<'a>
impl<'a> !UnwindSafe for Exporter<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more