cmark

My personal build of CMark ✏️

Commit
5eb01d279361ee7465d3a3f7d9494f1cd1018dd6
Parent
3894dbddbf4142748bc0dd72c5460b860dd8b5ef
Author
Doeme <das1993@hotmail.com>
Date

Fixes for the LaTeX renderer (#182)

* Don't double-output the link in latex-rendering. * Prevent ligatures in dashes sensibly when rendering latex. \- is a hyphenation, so it doesn't get displayed at all. * Redo "Don't double-output the link in latex-rendering." This reverts commit 8fb1f1c3c8799628141780ca5fd8d70883c1ec53 and adds the proper solution to the problem. With commit 8fb1f1c3c double rendering is fixed, but the url isn't escaped anymore, so I discarded the wrong copy. We now return 0 from the function in case of a single link, which stops processing the contents of the node. * Add a comment about the double-rendering issue addressed in 1c0d4749451cf85a849a3cf8e41cf137789821d4

Diffstat

1 file changed, 3 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/latex.c 5 3 2
diff --git a/src/latex.c b/src/latex.c
@@ -42,7 +42,7 @@ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape,
     break;
   case 45:             // '-'
     if (nextc == 45) { // prevent ligature
-      cmark_render_ascii(renderer, "\\-");
+      cmark_render_ascii(renderer, "-{}");
     } else {
       cmark_render_ascii(renderer, "-");
     }
@@ -390,7 +390,8 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
       case URL_AUTOLINK:
         LIT("\\url{");
         OUT(url, false, URL);
-        break;
+        LIT("}");
+        return 0; // Don't process further nodes to avoid double-rendering artefacts
       case EMAIL_AUTOLINK:
         LIT("\\href{");
         OUT(url, false, URL);