aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-09 14:03:04 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-09 14:03:04 +0200
commitcba78821ed13d5a92c74d092914fbad4c842f889 (patch)
tree669b341687e0e1fc9f443625d7a29c5a56d9f700 /src
parent10355a403f57c93a074716c785d588c76de5634c (diff)
downloadmarkdown-rs-cba78821ed13d5a92c74d092914fbad4c842f889.tar.gz
markdown-rs-cba78821ed13d5a92c74d092914fbad4c842f889.tar.bz2
markdown-rs-cba78821ed13d5a92c74d092914fbad4c842f889.zip
Add temporary support for stripping whitespace
Diffstat (limited to '')
-rw-r--r--src/compiler.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler.rs b/src/compiler.rs
index 4f362b8..3632d29 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -280,11 +280,15 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
}
// To do: `ContentPhrasing` should be parsed as phrasing first.
// This branch below currently acts as the resulting `data` tokens.
- TokenType::ContentChunk
+ // To do: initial and final whitespace should be handled in `text`.
+ TokenType::ContentChunk => {
+ // last_was_tag = false;
+ buf_tail_mut(buffers).push(encode(
+ slice_serialize(codes, &get_span(events, index), false).trim(),
+ ));
+ }
// To do: `ChunkString` does not belong here. Remove it when subtokenization is supported.
- | TokenType::ChunkString
- | TokenType::Data
- | TokenType::CharacterEscapeValue => {
+ TokenType::ChunkString | TokenType::Data | TokenType::CharacterEscapeValue => {
// last_was_tag = false;
buf_tail_mut(buffers).push(encode(&slice_serialize(
codes,