# Replace generated content / post processing hooks?

**URL:** <https://discourse.gohugo.io/t/replace-generated-content-post-processing-hooks/25129>\
**Category:** support\
**Created:** [April 29, 2020, 3:39pm UTC](https://discourse.gohugo.io/t/replace-generated-content-post-processing-hooks/25129 "2020-04-29T15:39:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prav](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/prav/32/5688_2.png) [@Prav](https://discourse.gohugo.io/u/Prav)\
**Post date:** [April 29, 2020, 3:39pm UTC](https://discourse.gohugo.io/t/replace-generated-content-post-processing-hooks/25129/1 "2020-04-29T15:39:41Z")

</div>

Is there any way to replace the html content generated before it is saved to disk?

I use pure-css and want my tables to automatically specify a few classes. Before moving to hugo, I could simply add {.classname} after a markdown block and nanoc would include those classes. I understand goldmark doesn’t support this.

I have tried a bunch of things, and the following gets me close

`{{ replace .Content "<table>" "<table class='pure-table pure-table-striped'>" | markdownify}}`

which works if I set config.toml to contain

```
[markup]
  [markup.goldmark]
    [markup.goldmark.renderer]
      unsafe = true

```

However, the `| markdownify` then causes the chroma syntax highlighting to break as it messes up the spacing in my code blocks.

Is there a better solution? Perhaps creating a post-processing hook?

---

<div class="post-metadata">

**Author:** ![pamubay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pamubay/32/17838_2.png) [@pamubay](https://discourse.gohugo.io/u/pamubay)\
**Post date:** [April 29, 2020, 4:27pm UTC](https://discourse.gohugo.io/t/replace-generated-content-post-processing-hooks/25129/2 "2020-04-29T16:27:42Z")

</div>

No need to `markdownify` again. The ouput of `.Content` is already processed by goldmark.

And yes, you need to use `unsafe = true` option.

---

<div class="post-metadata">

**Author:** ![Prav](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/prav/32/5688_2.png) [@Prav](https://discourse.gohugo.io/u/Prav)\
**Post date:** [April 29, 2020, 4:39pm UTC](https://discourse.gohugo.io/t/replace-generated-content-post-processing-hooks/25129/3 "2020-04-29T16:39:50Z")

</div>

> [@pamubay](#):
>
> No need to `markdownify` again. The ouput of `.Content` is already processed by goldmark.

Unfortunately, looks like markdownify is needed. Without it, the output displays the html tags as well.

---

<div class="post-metadata">

**Author:** ![pamubay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pamubay/32/17838_2.png) [@pamubay](https://discourse.gohugo.io/u/pamubay)\
**Post date:** [April 29, 2020, 5:19pm UTC](https://discourse.gohugo.io/t/replace-generated-content-post-processing-hooks/25129/4 "2020-04-29T17:19:41Z")

</div>

Use `safeHTML`.

```auto
{{ replace .Content "<table>" "<table class='pure-table pure-table-striped'>" | safeHTML }}

```

---

<div class="post-metadata">

**Author:** ![Prav](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/prav/32/5688_2.png) [@Prav](https://discourse.gohugo.io/u/Prav)\
**Post date:** [April 29, 2020, 5:22pm UTC](https://discourse.gohugo.io/t/replace-generated-content-post-processing-hooks/25129/5 "2020-04-29T17:22:23Z")

</div>

That did the trick! Thanks!
