Replies: 6 comments
-
It’s an interesting suggestion. A markdown-only approach would be preferred. The safeHTML declaration is all or nothing, so it wouldn’t improve anything (from a security perspective) to whitelist any HTML tags during post processing. I don’t believe there is any Markdown equivalent to produce small text though.It reminds me to look into the safeHTML configuration of the Hinode template. It should be disabled by default without breaking anything. The site admin can then deliberately adjust this setting.Your suggestion would be helpful to others, as long as they can still decide not to enable safeHTML globally. Should we use the Goldmark configuration for this?On 22 Aug 2023, at 18:53, myrthos ***@***.***> wrote:
I had the need to add a HTML tag to the TOC for documentation. In this case <small>. it would look something like this in the yaml file:
- title: Peripheral
pages:
- title: CLC <small>Configurable Logic Cell</small>
- title: CLK <small>Clock Circuitry</small>
- title: CLR <small>Clock Reference</small>
This messes things up as the tags are not used and the link is a mess. I fixed both issues in sidebar.html by changing $doc_slug to {{- $doc_slug := $title | plainify | urlize -}}
And changing {{ $title }} to {{ $title | safeHTML }}`
Ideally I would have wanted to limit the allowed set of html tags (like small, em, sup and sub), but have no idea how to do that in Hugo, without making it complicated.
My suggestion is to add to Hinode, the support for HTML tags in the side bar.
I have a solution, so it is not necessary for me, but I just think it might be useful to others as well to have that functionality.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Markdown doesn't support An alternative solution I thought of, instead of html or markdown, is using css styling by means of a shortcode. So, something like this: That would allow someone to go really wild on creating styles (although many already exist) and it can also be used in markdown, thus reducing the need further for using html in markdown. It would need a regular expression I think to remove the shortcode tags in order to be able to create the link. |
Beta Was this translation helpful? Give feedback.
-
I took the effort and created a shortcode that does what I mentioned above. I named it
Furthermore in As an example, the data file: - title: Peripheral
pages:
- title: CLC {{< mstyle "small" >}}Configurable Logic Cell{{< /mstyle >}}
- title: CLK {{< mstyle "sup" >}}Clock Circuitry{{< /mstyle >}}
- title: CLR {{< mstyle "sub" >}}Clock Reference{{< /mstyle >}}
.sup {
vertical-align: super;
font-size: smaller;
line-height: normal;
}
.sub {
vertical-align: sub;
font-size: smaller;
line-height: normal;
} Obviously this is not what my menu is going to look like, I just use it as an example. The good thing is that it no longer needs HTML. |
Beta Was this translation helpful? Give feedback.
-
I found out that the shortcode I listed needs and extra |
Beta Was this translation helpful? Give feedback.
-
I'm adding a few new shortcodes to release |
Beta Was this translation helpful? Give feedback.
-
I'm not sure that I understand how that would work. The regex is for creating the link from the title (from the yaml file), without it the link would still contain the HTML as text, as the shortcode is part of the title. As I don't understand, I just tested it in my The yaml line for one of the titles looks like this: For creating the link in So, I am using |
Beta Was this translation helpful? Give feedback.
-
I had the need to add a HTML tag to the TOC for documentation. In this case
<small>
. it would look something like this in the yaml file:This messes things up as the tags are not used and the link is a mess. I fixed both issues in
sidebar.html
by changing$doc_slug
to{{- $doc_slug := $title | plainify | urlize -}}
And changing
{{ $title }} to
{{ $title | safeHTML }}`Ideally I would have wanted to limit the allowed set of html tags (like
small
,em
,sup
andsub
), but have no idea how to do that in Hugo, without making it complicated.My suggestion is to add to Hinode, the support for HTML tags in the side bar.
I have a solution, so it is not necessary for me, but I just think it might be useful to others as well to have that functionality.
Beta Was this translation helpful? Give feedback.
All reactions