Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var xrefRegex = new Regex("<xref href=\"(.+?)\" data-throw-if-not-resolved=\"false\"></xref>", RegexOptions.Compiled);
var langwordXrefRegex =
new Regex("<xref uid=\"langword_csharp_.+?\" name=\"(.+?)\" href=\"\"></xref>", RegexOptions.Compiled);
var codeBlockRegex = new Regex("<pre><code class=\"lang-csharp\">((.|\n)+?)</code></pre>", RegexOptions.Compiled);
var codeBlockRegex = new Regex("<pre><code class=\"lang-([a-zA-Z0-9]+)\">((.|\n)+?)</code></pre>", RegexOptions.Compiled);
var codeRegex = new Regex("<code>(.+?)</code>", RegexOptions.Compiled);
var linkRegex = new Regex("<a href=\"(.+?)\">(.+?)</a>", RegexOptions.Compiled);
var brRegex = new Regex("<br */?>", RegexOptions.Compiled);
Expand Down Expand Up @@ -210,7 +210,7 @@ string Link(string uid, bool linkFromGroupedType, bool nameOnly = false, bool li
return Link(uid, linkFromGroupedType);
});
summary = langwordXrefRegex.Replace(summary, match => $"`{match.Groups[1].Value}`");
summary = codeBlockRegex.Replace(summary, match => $"```csharp\n{match.Groups[1].Value.Trim()}\n```");
summary = codeBlockRegex.Replace(summary, match => $"```{match.Groups[1].Value.Trim()}\n{match.Groups[2].Value.Trim()}\n```");
summary = codeRegex.Replace(summary, match => $"`{match.Groups[1].Value}`");
summary = linkRegex.Replace(summary, match => $"[{match.Groups[2].Value}]({match.Groups[1].Value})");
summary = brRegex.Replace(summary, _ => config.BrNewline);
Expand Down