Add basic support for panels and code block in jiradoc
This commit is contained in:
parent
fa387c5546
commit
dcc8882740
2 changed files with 21 additions and 1 deletions
|
@ -33,15 +33,34 @@ fn render_doc_node(f: &mut String, node: &DocNode) -> Result<(), Box<dyn std::er
|
||||||
writeln!(f, "---")?;
|
writeln!(f, "---")?;
|
||||||
}
|
}
|
||||||
DocNode::Heading(x) => {
|
DocNode::Heading(x) => {
|
||||||
|
writeln!(f)?;
|
||||||
|
write!(f, "## ")?;
|
||||||
for node in x {
|
for node in x {
|
||||||
render_text_node(f, node)?;
|
render_text_node(f, node)?;
|
||||||
}
|
}
|
||||||
|
writeln!(f)?;
|
||||||
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
DocNode::MediaSingle(x) => {
|
DocNode::MediaSingle(x) => {
|
||||||
for node in x {
|
for node in x {
|
||||||
render_text_markets(f, node)?;
|
render_text_markets(f, node)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DocNode::Panel(x) => {
|
||||||
|
writeln!(f, "┌{:─<79}", "")?;
|
||||||
|
for node in x {
|
||||||
|
render_doc_node(f, node)?;
|
||||||
|
}
|
||||||
|
writeln!(f, "└{:─<79}", "")?;
|
||||||
|
}
|
||||||
|
DocNode::CodeBlock(x) => {
|
||||||
|
writeln!(f, "┌---------------")?;
|
||||||
|
for node in x {
|
||||||
|
render_text_node(f, node)?;
|
||||||
|
}
|
||||||
|
writeln!(f)?;
|
||||||
|
writeln!(f, "└---------------")?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -17,6 +17,8 @@ pub enum DocNode {
|
||||||
Rule,
|
Rule,
|
||||||
Heading(Vec<DocTextNode>),
|
Heading(Vec<DocTextNode>),
|
||||||
MediaSingle(Vec<DocTextMarker>),
|
MediaSingle(Vec<DocTextMarker>),
|
||||||
|
Panel(Vec<DocNode>),
|
||||||
|
CodeBlock(Vec<DocTextNode>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
@ -86,5 +88,4 @@ pub struct DocMention {
|
||||||
pub struct DocMentionAttrs {
|
pub struct DocMentionAttrs {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub text: String,
|
pub text: String,
|
||||||
pub local_id: String,
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue