diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-21 12:06:51 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-21 12:06:51 +0200 |
commit | f99d131ec3ab60956344d001bcd40244343c241b (patch) | |
tree | ac798f9a6a1ab73021cdd5a5303e20424d37172e /src/tokenizer.rs | |
parent | 182467c1d393dee2081ff80f1c049cb145f23123 (diff) | |
download | markdown-rs-f99d131ec3ab60956344d001bcd40244343c241b.tar.gz markdown-rs-f99d131ec3ab60956344d001bcd40244343c241b.tar.bz2 markdown-rs-f99d131ec3ab60956344d001bcd40244343c241b.zip |
Add support for inferring line ending, configurable
* Rename `CompileOptions` to `Options`
* Add support for an optional default line ending style
* Add support for inferring the used line ending style
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r-- | src/tokenizer.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs index c0a7105..ba9bcbb 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -677,7 +677,6 @@ fn attempt_impl( } /// Turn a string into codes. -// To do: handle BOM at start? pub fn as_codes(value: &str) -> Vec<Code> { let mut codes: Vec<Code> = vec![]; let mut at_start = true; @@ -748,7 +747,10 @@ pub fn as_codes(value: &str) -> Vec<Code> { }; } - // To do: handle a final CR? + // Send the last CR: we’re not at a next `\n`. + if at_carriage_return { + codes.push(Code::Char('\r')); + } codes } |