Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove static phrasing content #42

Merged
merged 1 commit into from
Jun 15, 2023
Merged

Remove static phrasing content #42

merged 1 commit into from
Jun 15, 2023

Conversation

wooorm
Copy link
Member

@wooorm wooorm commented Feb 4, 2023

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

Previously, there was a difference between static and dynamic phrasing
content.
There was also transparent content, to “inherit” the (static or dynamic)
content model from a parent.
This was used to prohibit links in links.

However, while it is unwise to put links in links, it is possible with
markdown to do so, by embedding autolinks in links with resources or
references.
Take for example:

[alpha <https://bravo> charlie](delta)

Yields, per CommonMark:

<p><a href="delta">alpha <a href="https://bravo">https://bravo</a> charlie</a></p>

See also: commonmark/commonmark-spec#719.

There is also the case where while it is unwise to author such markdown,
tools transforming mdast might inject links.
It’s probably good to handle such cases in mdast-util-to-markdown and
such?

Not allowing links in links is also something imposed by HTML (particularly
the parsing side1): perhaps mdast could be used in places where this
restriction doesn’t need to be imposed.

Finally, it is hard to type such inherited content models.
As in, transparent content is not used in @types/mdast (I don’t think it
can be typed?):

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3b052a3e5b59b0efaa22669d9bd8f268bd689835/types/mdast/index.d.ts#L286

So, this PR is a proposal to remove the difference and simplify the AST.

Footnotes

  1. You can produce nested as with the DOM:

    let a1 = document.createElement('a'); a1.textContent = 'alpha';
    let a2 = document.createElement('a'); a2.textContent = 'bravo';
    a1.appendChild(a2)
    document.body.appendChild(a1)
    

Previously, there was a difference between static and dynamic phrasing
content.
There was also transparent content, to “inherit” the (static or dynamic)
content model from a parent.
This was used to prohibit links in links.

However, while it is unwise to put links in links, it is possible with
markdown to do so, by embedding autolinks in links with resources or
references.
Take for example:

```markdown
[alpha <https://bravo> charlie](delta)
```

Yields, per CommonMark:

```html
<p><a href="delta">alpha <a href="https://bravo">https://bravo</a> charlie</a></p>
```

See also: commonmark/commonmark-spec#719.

There is also the case where while it is unwise to author such markdown,
tools transforming mdast might inject links.
It’s probably good to handle such cases in `mdast-util-to-markdown` and
such?

Not allowing links in links is also something imposed by HTML (particularly
the parsing side[^1]): perhaps mdast could be used in places where this
restriction doesn’t need to be imposed.

Finally, it is hard to type such inherited content models.
As in, transparent content is not used in `@types/mdast` (I don’t think it
can be typed?):

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3b052a3e5b59b0efaa22669d9bd8f268bd689835/types/mdast/index.d.ts#L286

So, this PR is a proposal to remove the difference and simplify the AST.

[^1]: You can produce nested `a`s with the DOM:

    ```js
    let a1 = document.createElement('a'); a1.textContent = 'alpha';
    let a2 = document.createElement('a'); a2.textContent = 'bravo';
    a1.appendChild(a2)
    document.body.appendChild(a1)
    ```
@github-actions github-actions bot added the 👋 phase/new Post is being triaged automatically label Feb 4, 2023
@github-actions

This comment has been minimized.

@github-actions github-actions bot added 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Feb 4, 2023
@wooorm wooorm merged commit f7df75f into main Jun 15, 2023
@wooorm wooorm deleted the remove-static-dynamic branch June 15, 2023 10:37
@github-actions

This comment has been minimized.

@wooorm wooorm added the 💪 phase/solved Post is done label Jun 15, 2023
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

Successfully merging this pull request may close these issues.

1 participant