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

Distinguish bare <> from normal ()[] links in the ast #63

Closed
matklad opened this issue Nov 3, 2022 · 3 comments
Closed

Distinguish bare <> from normal ()[] links in the ast #63

matklad opened this issue Nov 3, 2022 · 3 comments

Comments

@matklad
Copy link
Contributor

matklad commented Nov 3, 2022

<http://example.com> [My Link](http://example.com)
[
  {
    "children": [
      {
        "tag": "str",
        "text": "http://example.com"
      }
    ],
    "tag": "link",
    "destination": "http://example.com"
  },
  {
    "tag": "str",
    "text": " "
  },
  {
    "children": [
      {
        "tag": "str",
        "text": "My Link"
      }
    ],
    "tag": "link",
    "destination": "http://example.com"
  }
]

The problem here is that the two cases are indistinguishable on the AST layer, but it might be usful. In particular, they might want different word-break css.

@jgm
Copy link
Owner

jgm commented Nov 3, 2022

Pandoc handles this by adding a uri class to "autolinks" (<..>). We could do something similar.

@matklad
Copy link
Contributor Author

matklad commented Nov 3, 2022

My gut feeling is probably do just

{
    "tag": "autolink",
    "destination": "http://example.com"
}

It seems best to add "desugaring" of the destination into children to the rendered -- it might want to, for example, strip the protocol so that it is rendered as example.com.

@jgm
Copy link
Owner

jgm commented Nov 4, 2022

Yes, that probably makes more sense.

@jgm jgm closed this as completed in 41f42a6 Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants