From 6739851aba28c31558946acf886a9ac3276762e6 Mon Sep 17 00:00:00 2001 From: trivernis Date: Fri, 7 Aug 2020 15:50:47 +0200 Subject: [PATCH] Fix problems with missing newline at eof --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/parser/mod.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24757ce..43d2b8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1117,7 +1117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "snekdown" -version = "0.21.0" +version = "0.21.1" dependencies = [ "asciimath-rs 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 388f563..06e09fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "snekdown" -version = "0.21.0" +version = "0.21.1" authors = ["trivernis "] edition = "2018" license-file = "LICENSE" diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 0a17781..c8b1cac 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -99,6 +99,9 @@ impl Parser { reader .read_to_string(&mut text) .expect("Failed to read file"); + if text.chars().last() != Some('\n') { + text.push('\n'); + } let document = Document::new(!is_child); Self {