martignoni / hugo-notice

A Hugo theme component to display nice notices
GNU General Public License v3.0
236 stars 48 forks source link

Some questions #35

Closed rea1shane closed 3 months ago

rea1shane commented 6 months ago

Hi @martignoni . Thank you so much for solving my problem with this repository! Now I'd like to create a PR to make this project better, but there are a few questions I need to ask you about:

  1. Why is the notice.html minified, won't Hugo minify it automatically?

And some non-PR related questions:

  1. What is "Workaround markdownify inconsistency for single/multiple paragraphs"?
  2. How to make the shortcode work only on paragraphs, not in e.x. code blocks?
martignoni commented 6 months ago

Why is the notice.html minified, won't Hugo minify it automatically?

Hugo doesn't minify automatically, only if you ask for it (with --minify or by post-processing), see https://gohugo.io/commands/hugo/ and https://gohugo.io/hugo-pipes/minification/.

What is "Workaround markdownify inconsistency for single/multiple paragraphs"?

See https://github.com/gohugoio/hugo/issues/5975, e.g. https://github.com/gohugoio/hugo/issues/5975#issuecomment-494746975

How to make the shortcode work only on paragraphs, not in e.x. code blocks?

Don't know, but why? Just do not use it in code blocks (I probably don't see your use case).

rea1shane commented 6 months ago

Don't know, but why? Just do not use it in code blocks (I probably don't see your use case).

This will prevent me from showing its syntax.

For example showing GitHub alerts syntax:

> [!NOTE]
> Useful information that users should know, even when skimming content.

In the paragraph looks like:

[!NOTE] Useful information that users should know, even when skimming content.

But when I showing shortcode syntax, it won't show the source code in the code block. Instead, it shows the rendered look.

martignoni commented 6 months ago

What does your hugo code looks like when doing this?

rea1shane commented 6 months ago

What does your hugo code looks like when doing this?

image

source code:

## Test

```
{{< notice warning >}}
This is a warning notice. Be warned!
{{< /notice >}}
```

{{< notice warning >}}
This is a warning notice. Be warned!
{{< /notice >}}
rea1shane commented 6 months ago

Hugo doesn't minify automatically, only if you ask for it (with --minify or by post-processing), see https://gohugo.io/commands/hugo/ and https://gohugo.io/hugo-pipes/minification/.

I have an opinion, would it be possible to not minify the files, but rather have the user minify them at build time (this is what now I do), as the source code is just too hard to read and develop.

martignoni commented 6 months ago

Would it be possible to not minify the files, but rather have the user minify them at build time

I think this makes sense. Please make a PR for it!

martignoni commented 6 months ago

What does your hugo code looks like when doing this?

Did you try this: https://github.com/gohugoio/hugo/issues/11054#issuecomment-1572295424?

rea1shane commented 6 months ago

Would it be possible to not minify the files, but rather have the user minify them at build time

I think this makes sense. Please make a PR for it!

See https://github.com/martignoni/hugo-notice/pull/36

martignoni commented 3 months ago

Thank you for the PRs. I've finally had time to review them.