Skip to content

Commit

Permalink
Escape markup before parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
principis committed Apr 9, 2024
1 parent c5475a7 commit 55f1bac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tldr-sharp/PageParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static class PageParser

internal static string ParseLine(string line, bool formatted = false)
{
line = line.EscapeMarkup();
return Config.AnsiSupport ? ParseAnsiLine(line, formatted) : ParsePlainLine(line, formatted);
}

Expand Down Expand Up @@ -50,7 +51,7 @@ private static string ParsePlainLine(string line, bool formatted = false)

private static string ParseAnsiLine(string line, bool formatted = false)
{
var builder = new StringBuilder(line.EscapeMarkup());
var builder = new StringBuilder(line);

foreach (var match in PlaceholderRegex.Matches(line).Reverse()) {
if (match.Groups.Count != 3) continue;
Expand Down

0 comments on commit 55f1bac

Please sign in to comment.