From 2ac267e68fbf2ef1ac321dc0b9b2530bd8a83746 Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Wed, 27 Mar 2024 08:53:16 +0000 Subject: [PATCH] Fix incorrect regex: asterisks don't need to be quoted when used in a character set. This incorrectly included the backslash into the character set. --- md2tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/md2tex b/md2tex index c493544..38f093e 100755 --- a/md2tex +++ b/md2tex @@ -45,8 +45,8 @@ function inline(text) { gsub(/&/, "\\\\&", text) gsub(/\^/, "\\textasciicircum ", text) gsub(/\.{3,}/, "\\ldots", text) - text = gensub(/\*\*([^\*]*)\*\*/, "\\textbf{\\1}", "g", text) - text = gensub(/\*([^\*]*)\*/, "\\emph{\\1}", "g", text) + text = gensub(/\*\*([^*]+)\*\*/, "\\textbf{\\1}", "g", text) + text = gensub(/\*([^*]+)\*/, "\\emph{\\1}", "g", text) text = gensub(/`([^`]*)`/, "\\texttt{\\1}", "g", text) # links text = gensub(/\[(.*)\]\((.*)\)/, "\\href{\\2}{\\1}\\footnote{\\url{\\2}}", "g", text)