zola/components/rendering/src/lib.rs
Vincent Prouillet 4a87689cfb Add class based syntax higlighting + line numbers (#1531)
* Add class based syntax higlighting + line numbers

* Use fork of syntect for now

* Fix tests

* Fix diff background on inline highlighter

Co-authored-by: evan-brass <evan-brass@protonmail.com>
2021-07-10 08:53:19 +02:00

24 lines
665 B
Rust

mod codeblock;
mod context;
mod markdown;
mod shortcode;
mod table_of_contents;
use errors::Result;
pub use context::RenderContext;
use markdown::markdown_to_html;
pub use shortcode::render_shortcodes;
pub use table_of_contents::Heading;
pub fn render_content(content: &str, context: &RenderContext) -> Result<markdown::Rendered> {
// Don't do shortcodes if there is nothing like a shortcode in the content
if content.contains("{{") || content.contains("{%") {
let rendered = render_shortcodes(content, context)?;
let html = markdown_to_html(&rendered, context)?;
return Ok(html);
}
markdown_to_html(&content, context)
}