Add a prefix to footnote IDs.

This avoids a conflict with multiple blog posts rendering in the same stream.
This commit is contained in:
Tom Alexander
2023-12-19 17:51:35 -05:00
parent d4b290ebe6
commit 2e1c979127
7 changed files with 115 additions and 42 deletions

View File

@@ -10,6 +10,13 @@ pub(crate) struct RenderContext<'intermediate> {
// TODO: Perhaps rename to output_root_directory.
pub(crate) output_directory: &'intermediate Path,
pub(crate) output_file: &'intermediate Path,
/// An optional string that gets added to IDs in HTML.
///
/// This is useful for cases where you may have conflicting HTML
/// IDs, for example, multiple blog posts with footnotes in a blog
/// stream.
pub(crate) id_addition: Option<&'intermediate str>,
}
impl<'intermediate> RenderContext<'intermediate> {
@@ -17,11 +24,13 @@ impl<'intermediate> RenderContext<'intermediate> {
config: &'intermediate Config,
output_directory: &'intermediate Path,
output_file: &'intermediate Path,
id_addition: Option<&'intermediate str>,
) -> Result<RenderContext<'intermediate>, CustomError> {
Ok(RenderContext {
config,
output_directory,
output_file,
id_addition,
})
}
}