diff --git a/README.md b/README.md index b6f43ec..3612a8d 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,7 @@ podman run -d --name kyanite -p 3621:3621 -e DATABASE_URL=postgres://xxx:xxx@xxx | DATABASE_URL | Required. Specifies the connection URl for the PostgreSQL database. | N/A | | HOST | Optional. The IP that Kyanite will listen on. | 0.0.0.0 | | PORT | Optional. The port that Kyanite will listen on. | 3621 | -| RUST_LOG | Optional. Sets the logging level. | INFO | \ No newline at end of file +| RUST_LOG | Optional. Sets the logging level. | INFO | + +## Features + diff --git a/src/block_types.rs b/src/block_types.rs index 1097cd0..70c8e9a 100644 --- a/src/block_types.rs +++ b/src/block_types.rs @@ -12,6 +12,9 @@ pub enum BlockTypes { MARKDOWN { content: String, }, + HTML { + content: String, + }, UNSUPPORTED } diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 4e5eecf..e50afd3 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -90,7 +90,8 @@ pub(crate) async fn root( let deserde: block_types::Header = serde_json::from_str(&f.content.as_str()).expect("Incorrect HEADER formatting"); BlockTypes::HEADER { text: deserde.text, size: deserde.size } - } + }, + "HTML" => BlockTypes::HTML { content: f.content }, _ => { warn!("Unsupported block type! ({})", f.r#type.as_str()); BlockTypes::UNSUPPORTED diff --git a/src/routes/page_resolver.rs b/src/routes/page_resolver.rs index e3440fd..d81b88f 100644 --- a/src/routes/page_resolver.rs +++ b/src/routes/page_resolver.rs @@ -68,13 +68,13 @@ pub(crate) async fn resolver( "HEADER" => { let deserde: block_types::Header = serde_json::from_str(&f.content.as_str()).expect("Incorrect HEADER formatting"); - BlockTypes::HEADER { text: deserde.text, size: deserde.size - } - } + BlockTypes::HEADER { text: deserde.text, size: deserde.size } + }, + "HTML" => BlockTypes::HTML { content: f.content }, _ => { - warn!("Unsupported block type! ({})", f.r#type.as_str()); - BlockTypes::UNSUPPORTED - } + warn!("Unsupported block type! ({})", f.r#type.as_str()); + BlockTypes::UNSUPPORTED + } } ).collect(); diff --git a/src/routes/post_resolver.rs b/src/routes/post_resolver.rs index f233dee..5a2f6a8 100644 --- a/src/routes/post_resolver.rs +++ b/src/routes/post_resolver.rs @@ -68,13 +68,13 @@ pub(crate) async fn resolver( "HEADER" => { let deserde: block_types::Header = serde_json::from_str(&f.content.as_str()).expect("Incorrect HEADER formatting"); - BlockTypes::HEADER { text: deserde.text, size: deserde.size - } - } + BlockTypes::HEADER { text: deserde.text, size: deserde.size } + }, + "HTML" => BlockTypes::HTML { content: f.content }, _ => { - warn!("Unsupported block type! ({})", f.r#type.as_str()); - BlockTypes::UNSUPPORTED - } + warn!("Unsupported block type! ({})", f.r#type.as_str()); + BlockTypes::UNSUPPORTED + } } ).collect(); diff --git a/templates/page.html b/templates/page.html index 5c135e2..3dd1cc4 100644 --- a/templates/page.html +++ b/templates/page.html @@ -30,6 +30,8 @@
{{ text }}
{% when BlockTypes::MARKDOWN { content } %} {{ content|markdown }} + {% when BlockTypes::HTML { content } %} + {{ content|safe }} {% when BlockTypes::HEADER { text, size } %}{{ text }}
{% when BlockTypes::MARKDOWN { content } %} {{ content|markdown }} + {% when BlockTypes::HTML { content } %} + {{ content|safe }} {% when BlockTypes::HEADER { text, size } %}