From 5b5b2eb83cb1f40cc828182275af828d1d11f5b5 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Wed, 1 Sep 2021 08:35:49 +0530 Subject: [PATCH] Add katex example with documentation (#69) --- exampleSite/config.toml | 8 ++++++- .../posts/theme-documentation-advanced.md | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index cfd5d3b..57d585a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -14,7 +14,13 @@ pygmentsStyle = "monokai" description = "Sky above, sand below and peace within" avatarURL = "/images/avatar.webp" avatarSize = "size-m" - customHeadHTML = "" + customHeadHTML = """ + + + + + """ showPostsOnHomePage = "popular" metaKeywords = ["blog", "gokarna", "hugo"] diff --git a/exampleSite/content/posts/theme-documentation-advanced.md b/exampleSite/content/posts/theme-documentation-advanced.md index 8948128..26c00b3 100644 --- a/exampleSite/content/posts/theme-documentation-advanced.md +++ b/exampleSite/content/posts/theme-documentation-advanced.md @@ -99,6 +99,30 @@ Giving users the freedom to add anything in the HTML via config.toml seemed like """ ``` +### Katex + +Katex is a math typesetting library for the web which lets you write beautiful equations. To use it, add the javascript as mentioned in [their documentation](https://katex.org/docs/browser.html) in our `params.customHeadHTML`. + +```markdown +[params] + customHeadHTML = """ + + + + + + + + """ +``` + +> Note: Make sure you use the latest version of katex and use the correct script tags as described in [their documentation](https://katex.org/docs/browser.html) + +Then the equation `$$y_t = \beta_0 + \beta_1 x_t + \epsilon_t$$` would be displayed as: + + $$y_t = \beta_0 + \beta_1 x_t + \epsilon_t$$ + ## Syntax Highlighting Hugo lets you choose the color scheme for the codeblocks. You can choose from the options here: https://xyproto.github.io/splash/docs/all.html