pango_md: Remove linebreaks within a paragraph

This commit is contained in:
Markus Koch 2018-03-25 09:42:40 +02:00
parent a6a3967940
commit 8cee5b5188

View File

@ -26,6 +26,18 @@ gchar *md_pango_render(gchar *markup, gint length)
g_free(str); g_free(str);
str = str2; str = str2;
regex = g_regex_new("(.+)\n", 0, 0, NULL);
str2 = g_regex_replace(regex, str, -1, 0, "\\1 ", 0, NULL);
g_regex_unref(regex);
g_free(str);
str = str2;
regex = g_regex_new("\n", 0, 0, NULL);
str2 = g_regex_replace(regex, str, -1, 0, "\n\n", 0, NULL);
g_regex_unref(regex);
g_free(str);
str = str2;
regex = g_regex_new("\\*{2}([^\\*\n]*)\\*{2}", 0, 0, NULL); regex = g_regex_new("\\*{2}([^\\*\n]*)\\*{2}", 0, 0, NULL);
str2 = g_regex_replace(regex, str, -1, 0, "<b>\\1</b>", 0, NULL); str2 = g_regex_replace(regex, str, -1, 0, "<b>\\1</b>", 0, NULL);
g_regex_unref(regex); g_regex_unref(regex);