main section class to container and don't print #+END

This helps to make sure that simple css things like pico or simple
work better with our site. Also don't export the text #+END.
This commit is contained in:
Chris Cochrun 2026-03-31 11:12:39 -05:00
parent 38767b0f16
commit 4e894bbbca

View file

@ -92,7 +92,7 @@ impl OrgHtmlExporter {
impl Traverser for OrgHtmlExporter {
fn event(&mut self, event: Event, ctx: &mut TraversalContext) {
match event {
Event::Enter(Container::Document(_)) => self.output += "<main>\n",
Event::Enter(Container::Document(_)) => self.output += "<main class=\"container\">\n",
Event::Leave(Container::Document(_)) => self.output += "</main>\n",
Event::Enter(Container::Headline(headline)) => {
@ -311,6 +311,7 @@ impl Traverser for OrgHtmlExporter {
.parent()
.is_some_and(|parent| match parent.kind() {
SyntaxKind::KEYWORD
| SyntaxKind::SPECIAL_BLOCK
| SyntaxKind::DYN_BLOCK
| SyntaxKind::DRAWER
| SyntaxKind::DRAWER_END
@ -321,7 +322,10 @@ impl Traverser for OrgHtmlExporter {
{
()
} else {
let _ = write!(&mut self.output, "{}", HtmlEscape(text));
// END section seems to get through parser
if !text.contains("#+END") {
let _ = write!(&mut self.output, "{}", HtmlEscape(text));
}
}
}