Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion exampleSite/content/blogs/emoji-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<hr>

Expand Down
31 changes: 18 additions & 13 deletions exampleSite/content/blogs/math.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
```

3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/gurusabarish/hugo-profile

go 1.20
2 changes: 2 additions & 0 deletions layouts/_default/_markup/render-codeblock-math.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{ .Page.Store.Set "needMathJax" true -}}
$${{ .Inner | safeHTML -}}$$
14 changes: 12 additions & 2 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,20 @@
{{ end }}


{{ if (.Params.mathjax | default false) }}
{{ if (or .Params.mathjax (.Page.Store.Get "needMathJax")) | default false }}

{{ "<!-- MathJax -->" | safeHTML }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js" integrity="sha384-M5jmNxKC9EVnuqeMwRHvFuYUE8Hhp0TgBruj/GZRkYtiMrCRgH7yvv5KY+Owi7TW" crossorigin="anonymous"></script>
{{ $cdnURL := "https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js"}}
{{ with resources.GetRemote $cdnURL -}}
{{ with .Err -}}
{{ errorf "Error while retrieving MathJax script from CDN: %s." . -}}
{{ else -}}
{{ $secureCSS := . | resources.Fingerprint "sha512" -}}
<script src="{{ .RelPermalink }}" integrity="{{ $secureCSS.Data.Integrity }}" crossorigin="anonymous" ></script>
{{ end -}}
{{ else -}}
{{ errorf "Unable to retrieve MathJax script from CDN. Status: %s." .Data.Status -}}
{{ end -}}

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down
8 changes: 4 additions & 4 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ publish = "exampleSite/public"
command = 'cd exampleSite && echo -e "\ngoogleAnalytics: $GOOGLE_ANALYTICS \ndisqusShortname: $DISQUS_SHORTNAME \n" >> config.yaml && hugo --gc --minify --themesDir ../..'

[context.production.environment]
HUGO_VERSION = "0.92.0"
HUGO_VERSION = "0.117.0"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
HUGO_THEME = "repo"
Expand All @@ -12,22 +12,22 @@ HUGO_THEME = "repo"
command = "cd exampleSite && hugo --gc --minify --enableGitInfo --themesDir ../.."

[context.split1.environment]
HUGO_VERSION = "0.92.0"
HUGO_VERSION = "0.117.0"
HUGO_ENV = "production"
HUGO_THEME = "repo"

[context.deploy-preview]
command = "cd exampleSite && hugo --gc --minify --buildFuture --themesDir ../.. -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]
HUGO_VERSION = "0.92.0"
HUGO_VERSION = "0.117.0"
HUGO_THEME = "repo"

[context.branch-deploy]
command = "cd exampleSite && hugo --gc --minify --themesDir ../.. -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]
HUGO_VERSION = "0.92.0"
HUGO_VERSION = "0.117.0"

[context.next.environment]
HUGO_ENABLEGITINFO = "true"