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

minor inconsistencies with GFM #120

Open
slimsag opened this issue May 6, 2022 · 1 comment
Open

minor inconsistencies with GFM #120

slimsag opened this issue May 6, 2022 · 1 comment

Comments

@slimsag
Copy link

slimsag commented May 6, 2022

Not sure which of these are intentional differences or not. Feel free to close if not useful! Happy to break out specific ones into separate issues.

I found all of these by trying to run the Markdown that makes up ths Markdown cheatsheet through elm-markdown.


GFM hidden anchors not supported

<a name="videos"/>

in elm-markdown, this throws Ran into a oneOf with no possibilities!

https://ellie-app.com/hqBDTcpJRcFa1


GFM
 tags with code blocks inside not supported

In GFM <pre lang="no-highlight"><code> followed by a Markdown codeblock followed by </code></pre> is supported, and renders like this:

```
No language indicated, so no syntax highlighting. 
But let's throw in a <b>tag</b>.
```

In elm-markdown, this throws Ran into a oneOf with no possibilities!

https://ellie-app.com/hqBJb9ZTjBJa1


GFM <code> ``` </code> not supported

In GFM this is supported and renders like this: ```

In elm-markdown Ran into a oneOf with no possibilities!

https://ellie-app.com/hqBNh6T5HhNa1


GFM <dl> not supported

In GFM this is supported:

<dl>
  <dt>Definition list</dt>
  <dd>Is something people use sometimes.</dd>

  <dt>Markdown in HTML</dt>
  <dd>Use HTML <em>tags</em>.</dd>
</dl>

And renders as:

Definition list
Is something people use sometimes.
Markdown in HTML
Use HTML tags.

In elm-markdown Ran into a oneOf with no possibilities! https://ellie-app.com/hqBR34VxGnba1

@dillonkearns
Copy link
Owner

Hello @slimsag, dillonkearns/elm-markdown renders HTML blocks by defining explicit handlers for them like this:

https://ellie-app.com/d7R3b9FsHfCa1

So the behavior your seeing is as designed, the idea is that you opt in to deciding how to render HTML tags. That way you can define custom tags (like a <video-embed> tag or a <tweet-embed> tag with custom logic for example).

That said, there are a couple of things to discuss:

  1. The error message Ran into a oneOf with no possibilities! isn't very helpful and could be improved
  2. It would probably be helpful to have a way to define an explicit list of HTML tags to allow to render directly rather than with the custom HTML renderer configuration. The philosophy of this package is to try to use more high-level tags rather than directly embedding low-level HTML. But there are cases where it could be useful, or where you may be rendering something that is from something like a GitHub README and might include direct HTML elements, so it would be nice to have an API for choosing a set of HTML tags to allow directly.

I'd be up for discussing both of those more, I think it would be great to find some improvements there!

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