Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using external markdown compiler fuses words #21

Open
loebl opened this issue Nov 29, 2017 · 0 comments
Open

Using external markdown compiler fuses words #21

loebl opened this issue Nov 29, 2017 · 0 comments

Comments

@loebl
Copy link

loebl commented Nov 29, 2017

When using an external markdown program, some words in the resulting html are concatenated, meaning "some word" becomes "someword". I am using cmark as markdown program.

The bug appears if the markdown compiler does not produce a space at the end of a line.

The fix is easy: in weaver.d append a space on every line read. Patch appended.

diff --git a/lit/weaver.lit b/lit/weaver.lit
index 0c8630f..bb058c4 100644
--- a/lit/weaver.lit
+++ b/lit/weaver.lit
@@ -128,7 +128,7 @@ if (useMdCompiler) {
     pipes.stdin.close();
     auto status = wait(pipes.pid);
     string mdCompilerOutput;
-    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup;
+    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup ~ " ";
     if (status != 0) {
         warn(p.file, 1, "Custom markdown compilation failed: " ~ mdCompilerOutput ~ " -- Falling back to built-in markdown compiler");
         html = filterMarkdown(md, MarkdownFlags.disableUnderscoreEmphasis);
@@ -373,7 +373,7 @@ if (useMdCompiler) {
     pipes.stdin.close();
     auto status = wait(pipes.pid);
     string mdCompilerOutput;
-    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup;
+    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup ~ " ";
     if (status != 0) {
         warn(c.file, 1, "Custom markdown compilation failed: " ~ mdCompilerOutput ~ " -- Falling back to built-in markdown compiler");
         html = filterMarkdown(md, MarkdownFlags.disableUnderscoreEmphasis);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant