Using render hooks instead of shortcodes

I am new to Hugo. I have a site which currently uses Jekyll. I am planning to port it to Hugo. Work in progress site.

While doing the migration, I am learning a lot of things. The current query I have is regarding the usage of render hooks instead of shortcodes.

For example. I have a render hook called render-codeblock-ashtml.html with the below code in it

<div>
  {{ safeHTML .Inner }}
</div>

With this to add some HTML in my markdown I just write as below

```ashtml
<div>my HTML content</div>
`` `

I think this is much cleaner than the shortcode syntax, and I can pass attributes easily.

Is this approach ok? Are there any unforeseen issues in using render hooks instead of shortcodes?

I use some render hooks for code samples

Check your config, hugo should know how to render this codes.
Sometimes you need to set a CSS class or have to insert son JS scripts.

HTH

It’s OK. There are some differences (for one, shortcodes can be nested), but if you don’t need those, then go ahead.

Thanks for the reply. I am not looking at nesting for now.

Thanks for sharing.