diff --git a/exampleSite/content/blogs/emoji-support.md b/exampleSite/content/blogs/emoji-support.md index 3c219aec5..ffdcb96e1 100644 --- a/exampleSite/content/blogs/emoji-support.md +++ b/exampleSite/content/blogs/emoji-support.md @@ -21,7 +21,7 @@ The [emojify](https://gohugo.io/functions/emojify/) function can be called direc To enable emoji globally, set ```enableEmoji``` to ```true``` in your site’s [configuration](https://gohugo.io/getting-started/configuration/) and then you can type emoji shorthand codes directly in content files; e.g. -The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference for emoji shorthand codes. +The [Emoji cheat sheet](https://www.webfx.com/tools/emoji-cheat-sheet/) is a useful reference for emoji shorthand codes.
diff --git a/exampleSite/content/blogs/math.md b/exampleSite/content/blogs/math.md index 2fe979715..ac9fffd75 100644 --- a/exampleSite/content/blogs/math.md +++ b/exampleSite/content/blogs/math.md @@ -5,34 +5,39 @@ draft: false author: "Gurusabarish" tags: - Markdown syntax - - Mathjax + - MathJax - example image: /images/mathjax.png description: "" toc: true -mathjax: true --- -## Mathjax +## MathJax -Math equations can be rendered using [Mathjax](https://www.mathjax.org) syntax with AMS symbol support. +Math equations can be rendered using [MathJax](https://www.mathjax.org) syntax with AMS symbol support. -Optionally enable this on a per-page basis by adding `mathjax: true` to your frontmatter. +Then, put your block equation inside a `math` code block. -Then, use `$$ ... $$` on a line by itself to render a block equation: +```` +```math +| Pr_{x \leftarrow P_{1}} [A(x) = 1] - Pr_{x \leftarrow P_{2}} [A(x) = 1] | < \text{negligible} +``` +```` + +This block above renders to : -$$ | Pr_{x \leftarrow P_{1}} [A(x) = 1] - Pr_{x \leftarrow P_{2}} [A(x) = 1] | < \text{negligible} $$ +```math +| Pr_{x \leftarrow P_{1}} [A(x) = 1] - Pr_{x \leftarrow P_{2}} [A(x) = 1] | < \text{negligible} +``` -The raw version is: +If you want to write in-line equations, you need manually enable MathJax support on a per-page basis by adding `mathjax: true` to your frontmatter. ``` -$$ | Pr_{x \leftarrow P_{1}} [A(x) = 1] - Pr_{x \leftarrow P_{2}} [A(x) = 1] | < \text{negligible} $$ +Now you can write in-line equations with `\\( ... \\)` , like \\( x^n / y \\) . It's easy! ``` +The block above renders to: -Write in-line equations with `\\( ... \\)` , like \\( x^n / y \\) . It's easy! +Now you can write in-line equations with `\\( ... \\)` , like \\( x^n / y \\) . It's easy! -``` -Write in-line equations with `\\( ... \\)` , like \\( x^n / y \\) . It's easy! -``` diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..2e16ce7ed --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/gurusabarish/hugo-profile + +go 1.20 diff --git a/layouts/_default/_markup/render-codeblock-math.html b/layouts/_default/_markup/render-codeblock-math.html new file mode 100644 index 000000000..a936cdf18 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-math.html @@ -0,0 +1,2 @@ +{{ .Page.Store.Set "needMathJax" true -}} +$${{ .Inner | safeHTML -}}$$ \ No newline at end of file diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index e5a55a83e..15f62785c 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -54,10 +54,17 @@ {{ end }} -{{ if (.Params.mathjax | default false) }} +{{ if (or .Params.mathjax (.Page.Store.Get "needMathJax")) | default false }} {{ "" | safeHTML }} - +{{ with resources.GetRemote "https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js" -}} + {{ with .Err -}} + {{ errorf "Error while retrieving MathJax script from CDN. Status: %s." .Data.Status -}} + {{ else -}} + {{ $secureCSS := . | resources.Fingerprint "sha512" -}} + + {{ end -}} +{{ end -}}