Skip to content

Commit

Permalink
Merge pull request #1917 from mateuszbartosik/master
Browse files Browse the repository at this point in the history
RDoc-3054 Fix for content-frame; make h6 linkable
  • Loading branch information
ppekrol authored Oct 2, 2024
2 parents fab3444 + d160a5c commit 0a27d40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Raven.Documentation.Parser/DocumentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public string Build(FolderItem page)
{
_content = NoteBlockHelper.GenerateNoteBlocks(_content);
_content = PanelBlockHelper.GeneratePanelBlocks(_content);
_content = CodeBlockHelper.GenerateCodeExamples(_content);
_content = CodeBlockHelper.GenerateContentFrames(_content);
}

if (_codeBlocks != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class CodeBlockHelper

private static readonly Regex CodeTabBlockFinder = new Regex(@"{CODE-TAB-BLOCK:(.+?)}(.*?){CODE-TAB-BLOCK/}", RegexOptions.Compiled | RegexOptions.Singleline);

private static readonly Regex CodeExampleFinder = new Regex(@"{CODE-EXAMPLE:(.+?)}(.*?){CODE-EXAMPLE/}", RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex ContentFrameFinder = new Regex(@"{CONTENT-FRAME:(.+?)}(.*?){CONTENT-FRAME/}", RegexOptions.Compiled | RegexOptions.Singleline);

private static readonly Regex FirstLineSpacesFinder = new Regex(@"^(\s|\t)+", RegexOptions.Compiled);

Expand Down Expand Up @@ -102,17 +102,15 @@ public static string GenerateCodeBlocks(string content, string documentationVers
return content;
}

public static string GenerateCodeExamples(string content)
public static string GenerateContentFrames(string content)
{
content = CodeExampleFinder.Replace(content, match => GenerateCodeExample(match.Groups[1].Value.Trim(), match.Groups[2].Value.Trim()));
content = ContentFrameFinder.Replace(content, match => GenerateContentFrame(match.Groups[1].Value.Trim(), match.Groups[2].Value.Trim()));

return content;
}

private static string GenerateCodeExample(string title, string content)
private static string GenerateContentFrame(string title, string content)
{
content = NormalizeContent(content);

var builder = new StringBuilder();
builder.AppendLine("<div class='content-frame'>");
if (string.IsNullOrWhiteSpace(title) == false)
Expand Down
2 changes: 1 addition & 1 deletion Raven.Documentation.Web/Views/Docs/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
}
});
document.addEventListener("DOMContentLoaded", function() {
Array.prototype.slice.call(document.querySelectorAll("#articleContainer h1, #articleContainer h2, #articleContainer h3, #articleContainer h4, #articleContainer h5")).forEach(function(e) {
Array.prototype.slice.call(document.querySelectorAll("#articleContainer h1, #articleContainer h2, #articleContainer h3, #articleContainer h4, #articleContainer h5, #articleContainer h6")).forEach(function(e) {
if (e.getAttribute("id")) {
var t = e.innerHTML;
var r = document.createElement("a");
Expand Down

0 comments on commit 0a27d40

Please sign in to comment.