diff --git a/apps/language_server/lib/language_server/markdown_utils.ex b/apps/language_server/lib/language_server/markdown_utils.ex index 98822a06d..680df1b89 100644 --- a/apps/language_server/lib/language_server/markdown_utils.ex +++ b/apps/language_server/lib/language_server/markdown_utils.ex @@ -1,7 +1,8 @@ defmodule ElixirLS.LanguageServer.MarkdownUtils do + @hash_match ~r/(? nil @@ -19,7 +20,7 @@ defmodule ElixirLS.LanguageServer.MarkdownUtils do if min_level do level_difference = base_level + 1 - min_level - Regex.replace(~r/(#+)/u, fragment, fn _, capture -> + Regex.replace(@hash_match, fragment, fn _, capture -> adjusted_level = String.length(capture) + level_difference String.duplicate("#", adjusted_level) end)