unimarkup-render

Crates.iounimarkup-render
lib.rsunimarkup-render
version0.4.0
sourcesrc
created_at2023-04-23 20:37:23.713265
updated_at2023-04-23 20:37:23.713265
descriptionCrate providing traits and types used for rendering Unimarkup markup.
homepagehttps://github.com/Unimarkup/unimarkup-rs
repositoryhttps://github.com/Unimarkup/unimarkup-rs
max_upload_size
id846821
size8,089
Nadir Fejzić (nfejzic)

documentation

README

Unimarkup Render

This crate defines types and traits used in the inline and core crate to render Unimarkup elements to all supported output formats. Therefore, all Unimarkup elements must implement the Render trait defined in this crate.

Add a new Unimarkup Element

Newly added Unimarkup elements must implement the Render trait.

impl Render for NewElement {
  fn render_html(&self) -> Result<Html, LogId> {
    // implement rendering to HTML for this new element
  }
}

Add a new Output Format

To add a new output format, the Render trait must be extended.

Note: This affects all Unimarkup elements implementing the Render trait!

pub trait Render {
  // ...
  // previous output formats
  // ...

  /// Renders Unimarkup to the new output format
  fn render_new_format(&self) => Result<NewFormat, LogId>;
}

Syntax Highlighting

The crate also provides syntax highlighting functionality in the highlight module using the syntect crate.

Commit count: 759

cargo fmt