Implement HTML block type
This commit is contained in:
parent
2359581c22
commit
fb6ba0dd50
7 changed files with 25 additions and 14 deletions
|
@ -24,3 +24,6 @@ podman run -d --name kyanite -p 3621:3621 -e DATABASE_URL=postgres://xxx:xxx@xxx
|
|||
| 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 |
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ pub enum BlockTypes {
|
|||
MARKDOWN {
|
||||
content: String,
|
||||
},
|
||||
HTML {
|
||||
content: String,
|
||||
},
|
||||
UNSUPPORTED
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -68,9 +68,9 @@ 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
|
||||
|
|
|
@ -68,9 +68,9 @@ 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
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
<p>{{ text }}</p>
|
||||
{% when BlockTypes::MARKDOWN { content } %}
|
||||
{{ content|markdown }}
|
||||
{% when BlockTypes::HTML { content } %}
|
||||
{{ content|safe }}
|
||||
{% when BlockTypes::HEADER { text, size } %}
|
||||
<h{{size}}>{{text}}</h{{size}}>
|
||||
{% else %}
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
<p>{{ text }}</p>
|
||||
{% when BlockTypes::MARKDOWN { content } %}
|
||||
{{ content|markdown }}
|
||||
{% when BlockTypes::HTML { content } %}
|
||||
{{ content|safe }}
|
||||
{% when BlockTypes::HEADER { text, size } %}
|
||||
<h{{size}}>{{text}}</h{{size}}>
|
||||
{% else %}
|
||||
|
|
Reference in a new issue