title: Remark: How to parse HTML tags and their content in MDAST
body: <p>I'm trying to parse a GitHub-flavoured markdown file using <a href="http://unifiedjs.com" rel="nofollow noreferrer">Unified</a> and <a href="https://www.npmjs.com/package/remark-parse" rel="nofollow noreferrer">Remark-Parse</a> to generate a MDAST. I'm able to parse most of it correctly and easily, however I'm having trouble parsing the HTML tags and their content from the AST.</p>
  <p>In the AST, HTML tags and their contents are represented as siblings, not parent-child. For example <code>&lt;sub&gt;hi&lt;/sub&gt;</code> is parsed into</p>
  <pre class="lang-json prettyprint-override"><code>[
    {
      &quot;type&quot;: &quot;paragraph&quot;,
      &quot;children&quot;: [
        {
          &quot;type&quot;: &quot;html&quot;,
          &quot;value&quot;: &quot;&lt;sub&gt;&quot;,
        },
        {
          &quot;type&quot;: &quot;text&quot;,
          &quot;value&quot;: &quot;hi&quot;,
        },
        {
          &quot;type&quot;: &quot;html&quot;,
          &quot;value&quot;: &quot;&lt;/sub&gt;&quot;,
        }
      ]
    }
  ]
  </code></pre>
  <p>Ideally, I would want it to be parsed like</p>
  <pre class="lang-json prettyprint-override"><code>[
    {
      &quot;type&quot;: &quot;paragraph&quot;,
      &quot;children&quot;: [
        {
          &quot;type&quot;: &quot;html&quot;,
          &quot;value&quot;: &quot;sub&quot;,
          &quot;children&quot;: [
            {
              &quot;type&quot;: &quot;text&quot;,
              &quot;value&quot;: &quot;hi&quot;,
            },
          ]
        },
      ]
    }
  ]
  </code></pre>
  <p>so that I can access the tag type and its content. (Specifically, my goal is to just skip over the tags and their content as they are not needed for my purposes)</p>
  <p>This is the configuration I am using currently:</p>
  <pre><code>import unified from 'unified';
  import markdown from 'remark-parse';
  import type {Block} from '@notionhq/client/build/src/api-types';
  import {parseRoot} from './internal';
  import gfm from 'remark-gfm';
  
  export function parseBody(body: string): Block[] {
    const tokens = unified().use(markdown).use(gfm).parse(body);
    return parseRoot(tokens);
  }
  </code></pre>
  <p>So, my question is: Is there a way of configuring Remark to do so / is there a Remark plugin to do this? If not, how would I go about creating a plugin that does so?</p>
  <p>Thanks.</p>