diff --git a/src/documents/markdown.rs b/src/documents/markdown.rs index 650499a..c0199fc 100644 --- a/src/documents/markdown.rs +++ b/src/documents/markdown.rs @@ -23,11 +23,16 @@ pub(crate) fn tree(text: &str) -> mdast::Node { markdown::to_mdast(text, &options()).expect("markdown without MDX always parses") } -/// A whole file as a syntax tree: front matter too. -pub(crate) fn file_tree(text: &str) -> mdast::Node { +/// How a whole file parses: front matter too. +pub fn file_options() -> ParseOptions { let mut options = options(); options.constructs.frontmatter = true; - markdown::to_mdast(text, &options).expect("markdown without MDX always parses") + options +} + +/// A whole file as a syntax tree. +pub(crate) fn file_tree(text: &str) -> mdast::Node { + markdown::to_mdast(text, &file_options()).expect("markdown without MDX always parses") } /// The bytes of the source a parsed node spans. diff --git a/src/documents/mod.rs b/src/documents/mod.rs index 207dd1c..f0597c3 100644 --- a/src/documents/mod.rs +++ b/src/documents/mod.rs @@ -44,6 +44,7 @@ pub(crate) use history::Change; pub use history::{PageHistoryDiff, Version, VersionHistory}; pub use knowledge::{Backlink, Backlinks, Favorite, Favorites, TrashBin, Trashed}; pub use link::LinkEditor; +pub use markdown::file_options as markdown_options; pub use markdown::markdown_highlights; pub use modes::{MarkdownEditor, MarkdownMode}; pub use pages::{PageCover, PageIcon};