# Switch between HTML and markdown in one .md file

**URL:** <https://discourse.gohugo.io/t/switch-between-html-and-markdown-in-one-md-file/15662>\
**Category:** support\
**Created:** [December 4, 2018, 6:44pm UTC](https://discourse.gohugo.io/t/switch-between-html-and-markdown-in-one-md-file/15662 "2018-12-04T18:44:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![schalkneethling](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@schalkneethling](https://discourse.gohugo.io/u/schalkneethling)\
**Post date:** [December 4, 2018, 6:44pm UTC](https://discourse.gohugo.io/t/switch-between-html-and-markdown-in-one-md-file/15662/1 "2018-12-04T18:44:49Z")

</div>

Hey All,

So I know you can use HTML in Hugo as well as Markdown. One stumbling block I have run into is that, from what I can tell, once you introduce HTML, everything else inside the opening and closing tags will be processed as HTML i.e.

```auto
<div class="something">
 ## Headline <!-- this will simply be output as ## Headline and not parsed as markdown -->
</div>

```

Is there a way to manually, via a directive maybe, tell Hugo to treat a block as Markdown even though it is wrapped in an HTML tag? Thanks!

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [December 4, 2018, 7:57pm UTC](https://discourse.gohugo.io/t/switch-between-html-and-markdown-in-one-md-file/15662/2 "2018-12-04T19:57:58Z")

</div>

You could do this with a shortcode.

Usage:

```nohighlight
{{< foo >}}
## Header
{{</ foo>}}

```

Definition:

```nohighlight
<div class="something">
{{ .Inner | markdownify }}
</div>

```

---

<div class="post-metadata">

**Author:** ![schalkneethling](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@schalkneethling](https://discourse.gohugo.io/u/schalkneethling)\
**Post date:** [December 6, 2018, 5:05am UTC](https://discourse.gohugo.io/t/switch-between-html-and-markdown-in-one-md-file/15662/3 "2018-12-06T05:05:54Z")

</div>

Thanks so much @zwbetz, that worked perfectly!
