-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
238 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,9 @@ public void BuildBlogs() | |
MarkdownPipeline pipeline = new MarkdownPipelineBuilder() | ||
.UseAlertBlocks() | ||
.UseFigures() | ||
.UseCitations() | ||
.UseFigures() | ||
.UseEmphasisExtras() | ||
.UseMathematics() | ||
.UseMediaLinks() | ||
.UseListExtras() | ||
|
@@ -247,9 +250,31 @@ private static string GetTitleFromMarkdown(string content) | |
} | ||
private string AddHtmlTags(string content, string title = "", string toc = "") | ||
{ | ||
string extensionHead = ""; | ||
if (content.Contains("<div class=\"mermaid\">")) | ||
{ | ||
extensionHead += "<script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js\"></script>" + Environment.NewLine; | ||
} | ||
if (content.Contains("<div class=\"math\">")) | ||
{ | ||
extensionHead += """ | ||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> | ||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-mml-chtml.js"></script> | ||
"""; | ||
} | ||
if (content.Contains("<div class=\"nomnoml\">")) | ||
{ | ||
extensionHead += """ | ||
<script src="//unpkg.com/graphre/dist/graphre.js"></script> | ||
<script src="//unpkg.com/nomnoml/dist/nomnoml.js"></script> | ||
"""; | ||
} | ||
|
||
var tplContent = TemplateHelper.GetTplContent("blog.html"); | ||
tplContent = tplContent.Replace("@{Title}", title) | ||
.Replace("@{BaseUrl}", BaseUrl) | ||
.Replace("@{ExtensionHead}", extensionHead) | ||
.Replace("@{toc}", toc) | ||
.Replace("@{content}", content); | ||
return tplContent; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.