syntax-tree/mdast-util-assert

Add tests for content types

wooorm opened this issue · 3 comments

Subject of the feature

mdast defines which nodes can be the direct children of other nodes.

Problem

The following example does not produce an error for text or link existing directly in listItem.

{
  type: 'root',
  children: [
    {
      type: 'list',
      children: [
        {
          type: 'listItem',
          children: [
            { type: 'text', value: 'text' },
            { type: 'link', url: 'https://example.com', children: [{ type: 'text', value: 'link' }] },
            { type: 'text', value: 'text' },
          ],
        },
      ],
    },
  ],
}

Expected behaviour

An error.

Supersedes remarkjs/remark#500.

A reason not to do this is that things like GFM, frontmatter, footnotes, directives, and other extensions, are not part of standard markdown nodes.
They’d either throw an error, or alternatively would have to be registered. But where?

Closing for now due to reason not to do this as outlined above

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.