aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-13 18:42:36 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-13 18:42:36 +0200
commitef644f4def7d5cad3fb5307ec5e00fc7b0b025ff (patch)
tree1d284b657d2cade8e3d4e60db09750c768bbc76f /src/compiler.rs
parent06b4ff3531874c95ec07b8440de526795408ef86 (diff)
downloadmarkdown-rs-ef644f4def7d5cad3fb5307ec5e00fc7b0b025ff.tar.gz
markdown-rs-ef644f4def7d5cad3fb5307ec5e00fc7b0b025ff.tar.bz2
markdown-rs-ef644f4def7d5cad3fb5307ec5e00fc7b0b025ff.zip
Add basic html (text)
* 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 😅
Diffstat (limited to '')
-rw-r--r--src/compiler.rs10
1 files changed, 8 insertions, 2 deletions
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) };