You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
620B

  1. mod context;
  2. mod markdown;
  3. mod shortcode;
  4. mod table_of_contents;
  5. use errors::Result;
  6. pub use context::RenderContext;
  7. use markdown::markdown_to_html;
  8. pub use shortcode::render_shortcodes;
  9. pub use table_of_contents::Heading;
  10. pub fn render_content(content: &str, context: &RenderContext) -> Result<markdown::Rendered> {
  11. // Don't do shortcodes if there is nothing like a shortcode in the content
  12. if content.contains("{{") || content.contains("{%") {
  13. let rendered = render_shortcodes(content, context)?;
  14. return markdown_to_html(&rendered, context);
  15. }
  16. markdown_to_html(&content, context)
  17. }