Skip to content

Made example contents working as expected and visible #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
43 changes: 26 additions & 17 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ theme = "hugo-coder"
languageCode = "en"
defaultContentLanguage = "en"
paginate = 20
pygmentsStyle = "bw"
pygmentsStyle = "b2"
pygmentsCodeFences = true
pygmentsCodeFencesGuessSyntax = true
enableEmoji = true
# Enable Disqus comments
# disqusShortname = "yourdiscussshortname"

# To enable inline assets
enableInlineShortcodes = true

[params]
author = "John Doe"
description = "John Doe's personal website"
Expand Down Expand Up @@ -75,23 +78,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"
Expand Down Expand Up @@ -190,3 +193,9 @@ url = "projects/"
name = "Contato"
weight = 5
url = "contact/"

# Enable html support inside markdown
[markup]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks fine. I'm only against this addition. This is not a mandatory configuration for this theme.
Please, could you remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing it will not render the blog posts provided correctly.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I met the same problem thought it is not a big deal.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to come back here.

  • About the 'abbr, sub, sup, kbd, mark' no styling, this should be just missing CSS rules.
  • The SVG file should be added with a shortcode. I don't know if there is a default one with Hugo, if not I can build one later.
  • Emoji should be working. Maybe we are using an old version of Hugo to build the preview. I'm going to take a look on that issue.

[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
2 changes: 1 addition & 1 deletion exampleSite/content/posts/emoji-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/content/posts/emoji-support.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
20 changes: 3 additions & 17 deletions exampleSite/content/posts/math-typesetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 }}
<!-- KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
{{ end }}
{{</ math.inline >}}

### Examples

{{< math.inline >}}
<p>
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
</p>
{{</ math.inline >}}
Inline math: $(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…)$

Block math:
$$
Expand Down
20 changes: 3 additions & 17 deletions exampleSite/content/posts/math-typesetting.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 }}
<!-- KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
{{ end }}
{{</ math.inline >}}

### Examples

{{< math.inline >}}
<p>
Notação inline: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
</p>
{{</ math.inline >}}
Notação inline: $(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…)$

Notação em bloco:
$$
Expand Down