From ef644f4def7d5cad3fb5307ec5e00fc7b0b025ff Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 13 Jun 2022 18:42:36 +0200 Subject: Add basic html (text) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add all states for html (text) * Fix to link paragraph tokens together * Add note about uncovered bug where linking paragraph tokens together doesn’t work 😅 --- src/compiler.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/compiler.rs') diff --git a/src/compiler.rs b/src/compiler.rs index c451887..619bbe5 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -78,6 +78,11 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St ignore_encode = true; } } + TokenType::HtmlText => { + if options.allow_dangerous_html { + ignore_encode = true; + } + } TokenType::Content | TokenType::AtxHeading | TokenType::AtxHeadingSequence @@ -93,6 +98,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::BlankLineWhitespace | TokenType::Whitespace | TokenType::HtmlFlowData + | TokenType::HtmlTextData | TokenType::CodeFencedFence | TokenType::CodeFencedFenceSequence | TokenType::CodeFencedFenceWhitespace @@ -131,10 +137,10 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St | TokenType::CharacterReferenceMarkerSemi | TokenType::Autolink | TokenType::AutolinkMarker => {} - TokenType::HtmlFlow => { + TokenType::HtmlFlow | TokenType::HtmlText => { ignore_encode = false; } - TokenType::HtmlFlowData => { + TokenType::HtmlFlowData | TokenType::HtmlTextData => { let slice = slice_serialize(codes, &get_span(events, index), false); let res = if ignore_encode { slice } else { encode(&slice) }; -- cgit