From 9b9ea48771a734d6e0089aaf6b64ba174cd7afde Mon Sep 17 00:00:00 2001 From: rabinadk1 Date: Wed, 12 May 2021 12:12:12 +0545 Subject: [PATCH 1/4] Made example contents working as expected and visible * Change pygmentsStyle from bw to b2 to make it more readable in dark mode * Add ability to insert html inside of markdowns * `math: true` uses mathjax. So use `katex:true` instead --- exampleSite/config.toml | 8 +++++++- exampleSite/content/posts/math-typesetting.md | 20 +++---------------- .../content/posts/math-typesetting.pt-br.md | 20 +++---------------- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 5f1956fcc..e4bf52fd2 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -4,7 +4,7 @@ theme = "hugo-coder" languageCode = "en" defaultContentLanguage = "en" paginate = 20 -pygmentsStyle = "bw" +pygmentsStyle = "b2" pygmentsCodeFences = true pygmentsCodeFencesGuessSyntax = true enableEmoji = true @@ -190,3 +190,9 @@ url = "projects/" name = "Contato" weight = 5 url = "contact/" + +# Enable html support inside markdown +[markup] + [markup.goldmark] + [markup.goldmark.renderer] + unsafe = true diff --git a/exampleSite/content/posts/math-typesetting.md b/exampleSite/content/posts/math-typesetting.md index 62831a9c1..8093f0293 100644 --- a/exampleSite/content/posts/math-typesetting.md +++ b/exampleSite/content/posts/math-typesetting.md @@ -3,7 +3,7 @@ author: Hugo Authors title: Math Typesetting date: 2019-03-08 description: A brief guide to setup KaTeX -math: true +katex: true --- Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries. @@ -21,27 +21,13 @@ In this example we will be using [KaTeX](https://katex.org/) {{ end }} ``` -- To enable KaTex globally set the parameter `math` to `true` in a project's configuration -- To enable KaTex on a per page basis include the parameter `math: true` in content files +- To enable KaTex on a per page basis include the parameter `katex: true` in content files **Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html) -{{< math.inline >}} -{{ if or .Page.Params.math .Site.Params.math }} - - - - -{{ end }} -{{}} - ### Examples -{{< math.inline >}} -

-Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\) -

-{{}} +Inline math: $(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…)$ Block math: $$ diff --git a/exampleSite/content/posts/math-typesetting.pt-br.md b/exampleSite/content/posts/math-typesetting.pt-br.md index 31dd3670b..a0b892f86 100644 --- a/exampleSite/content/posts/math-typesetting.pt-br.md +++ b/exampleSite/content/posts/math-typesetting.pt-br.md @@ -3,7 +3,7 @@ author: Hugo Authors title: Configuração de Equações Matemáticas date: 2019-03-08 description: Um guia rápido sobre utilizar KaTeX -math: true +katex: true --- Em um projeto Hugo as Notações Matemáticas podem ser usadas com a ajuda de bibliotecas JavaScript de terceiros. @@ -21,27 +21,13 @@ Nesse exemplo usaremos o [KaTeX](https://katex.org/). {{ end }} ``` -- Para ativar o KaTex globalmente defina o parâmetro `math` como `true` na confgiuração do projeto -- Para ativar o KaTex em páginas específicas inclua o parâmetro `math: true` nos arquivos de conteúdo +- Para ativar o KaTex em páginas específicas inclua o parâmetro `katex: true` nos arquivos de conteúdo **Nota:** Use a referência online [Supported TeX Functions](https://katex.org/docs/supported.html) como base para criar notações matemáticas. -{{< math.inline >}} -{{ if or .Page.Params.math .Site.Params.math }} - - - - -{{ end }} -{{}} - ### Examples -{{< math.inline >}} -

-Notação inline: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\) -

-{{}} +Notação inline: $(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…)$ Notação em bloco: $$ From 09ad703384c2ac1545a97e3c265e4451ba3a3fd9 Mon Sep 17 00:00:00 2001 From: rabinadk1 Date: Wed, 12 May 2021 12:21:48 +0545 Subject: [PATCH 2/4] Donot implement CSP on default, this helps during testing --- exampleSite/config.toml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e4bf52fd2..ec0aa4e96 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -75,23 +75,23 @@ customJS = [] # id = "gid" # If you want to implement a Content-Security-Policy, add this section -[params.csp] -childsrc = ["'self'"] -fontsrc = ["'self'", "https://fonts.gstatic.com", "https://cdn.jsdelivr.net/"] -formaction = ["'self'"] -framesrc = ["'self'"] -imgsrc = ["'self'"] -objectsrc = ["'none'"] -stylesrc = [ - "'self'", - "'unsafe-inline'", - "https://fonts.googleapis.com/", - "https://cdn.jsdelivr.net/" -] -scriptsrc = ["'self'", "'unsafe-inline'", "https://www.google-analytics.com"] -prefetchsrc = ["'self'"] +# [params.csp] +# childsrc = ["'self'"] +# fontsrc = ["'self'", "https://fonts.gstatic.com", "https://cdn.jsdelivr.net/"] +# formaction = ["'self'"] +# framesrc = ["'self'"] +# imgsrc = ["'self'"] +# objectsrc = ["'none'"] +# stylesrc = [ +# "'self'", +# "'unsafe-inline'", +# "https://fonts.googleapis.com/", +# "https://cdn.jsdelivr.net/" +# ] +# scriptsrc = ["'self'", "'unsafe-inline'", "https://www.google-analytics.com"] +# prefetchsrc = ["'self'"] # connect-src directive – defines valid targets for to XMLHttpRequest (AJAX), WebSockets or EventSource -connectsrc = ["'self'", "https://www.google-analytics.com"] +# connectsrc = ["'self'", "https://www.google-analytics.com"] [taxonomies] category = "categories" From 9dcae20be36b1e5e1942687d21b83e09668c778f Mon Sep 17 00:00:00 2001 From: rabinadk1 Date: Sat, 15 May 2021 15:53:12 +0545 Subject: [PATCH 3/4] Highlight emoji css as css not html --- exampleSite/content/posts/emoji-support.md | 2 +- exampleSite/content/posts/emoji-support.pt-br.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exampleSite/content/posts/emoji-support.md b/exampleSite/content/posts/emoji-support.md index f17f49a2b..0e6313369 100644 --- a/exampleSite/content/posts/emoji-support.md +++ b/exampleSite/content/posts/emoji-support.md @@ -23,7 +23,7 @@ The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference **N.B.** The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack; e.g. -{{< highlight html >}} +{{< highlight css >}} .emoji { font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols; } diff --git a/exampleSite/content/posts/emoji-support.pt-br.md b/exampleSite/content/posts/emoji-support.pt-br.md index 0aa0ae27c..55d680a3a 100644 --- a/exampleSite/content/posts/emoji-support.pt-br.md +++ b/exampleSite/content/posts/emoji-support.pt-br.md @@ -23,7 +23,7 @@ O [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) é uma referência úti **Nota:** Os passos anteriores ativam os caractéres e sequências de emoji do Padrão Unicode no Hugo, porém a renderização desses glifos depende do navegador e plataforma utilizada. Para escolher o estilo dos emojis você pode tanto usar um font de emoji de terceiros ou uma lista de fontes. Por exemplo: -{{< highlight html >}} +{{< highlight css >}} .emoji { font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols; } From b8f8c4f8927be94df843d61a6d569fcfb7ea6612 Mon Sep 17 00:00:00 2001 From: rabinadk1 Date: Sun, 8 Aug 2021 21:37:02 +0545 Subject: [PATCH 4/4] Make inline css work Make following posts work as intended. - emoji-support - placeholder-text --- exampleSite/config.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index ec0aa4e96..0ad6d84d0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -11,6 +11,9 @@ enableEmoji = true # Enable Disqus comments # disqusShortname = "yourdiscussshortname" +# To enable inline assets +enableInlineShortcodes = true + [params] author = "John Doe" description = "John Doe's personal website"