fix(html): keyword-in-heading badge + brackets in wikilink descriptions
This commit is contained in:
@@ -53,6 +53,10 @@ pub struct PreformattedNode {
|
||||
pub span: Span,
|
||||
pub content: String,
|
||||
pub language: Option<String>,
|
||||
/// Verbatim text after the opening `{{{`, trailing whitespace trimmed
|
||||
/// (e.g. `python` or `class="brush: python"`). vimwiki inserts this as
|
||||
/// raw attributes on the `<pre>` tag, so we preserve it for byte-parity.
|
||||
pub attrs: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
||||
@@ -17,6 +17,22 @@ pub enum Keyword {
|
||||
Stopped,
|
||||
}
|
||||
|
||||
impl Keyword {
|
||||
/// The literal source text of the keyword (e.g. `"TODO"`). Used both for
|
||||
/// the rendered span and for anchor/id derivation via [`inline_text`].
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Keyword::Todo => "TODO",
|
||||
Keyword::Done => "DONE",
|
||||
Keyword::Started => "STARTED",
|
||||
Keyword::Fixme => "FIXME",
|
||||
Keyword::Fixed => "FIXED",
|
||||
Keyword::Xxx => "XXX",
|
||||
Keyword::Stopped => "STOPPED",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum InlineNode {
|
||||
Text(TextNode),
|
||||
@@ -89,6 +105,7 @@ fn push_inline_text(inlines: &[InlineNode], out: &mut String) {
|
||||
InlineNode::Superscript(s) => push_inline_text(&s.children, out),
|
||||
InlineNode::Subscript(s) => push_inline_text(&s.children, out),
|
||||
InlineNode::Color(c) => push_inline_text(&c.children, out),
|
||||
InlineNode::Keyword(k) => out.push_str(k.keyword.label()),
|
||||
InlineNode::WikiLink(w) => match &w.description {
|
||||
Some(d) => push_inline_text(d, out),
|
||||
None => {
|
||||
|
||||
Reference in New Issue
Block a user