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

iframe yields Markdown Error #125

Closed
Aarkon opened this issue Nov 8, 2022 · 3 comments
Closed

iframe yields Markdown Error #125

Aarkon opened this issue Nov 8, 2022 · 3 comments

Comments

@Aarkon
Copy link

Aarkon commented Nov 8, 2022

For my use case (a band website), I have to rely on the embed-bits from YouTube and Bandcamp, both utilise iframes. For example:

<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/track=308386834/size=small/bgcol=ffffff/linkcol=0687f5/transparent=true/" seamless><a href="https://wiedergaenger.bandcamp.com/track/ein-h-herer-feind">Ein höherer Feind by Wiedergænger</a></iframe>

YouTube‘ doesn‘t look that different, structurally. But when I have any of those in my Markdown, the defaultHtmlRenderer gives me bad looks.

I know there are some issues here already dealing with inline html, but I felt it was good to not let my observation slip unnoticed. Great work anyhow, I‘m looking forward to write a renderer for elm-ui output already as your documentation made it pretty much crystal clear how to do that. 🙂

@dillonkearns
Copy link
Owner

Hi @Aarkon, there's some discussion of that topic here: #51.

I would like to figure out a nice design for how to handle passthrough HTML elements in the future.

Depending on your use case, you may be able to handle this by encapsulating this with a more high-level element, which in my opinion is cleaner when it's feasible.

So you could do something like this (abstracting out the low-level details that you want to encapsulate, like the player size, etc. and exposing the specific attributes you want to make customizable)

<bandcamp-player track="308386834" />

You can do this using the Markdown.Html API: https://package.elm-lang.org/packages/dillonkearns/elm-markdown/latest/Markdown-Html. Hope that helps!

I'll close this issue as I think that #51 already captures this. Feel free to continue the discussion there. Thanks!

@Aarkon
Copy link
Author

Aarkon commented Nov 17, 2022

I'll look into Markdown.Html, thank you!
The only issue I have with this approach is that I'd have to replace embed codes like the one from my example above with something custom, am I right? As I want non-developers to to edit the markup files, I'd say that's not ideal in terms of acceptance. Especially since my goal is to replace a crappy & bloated Word Press with your also very shiny Elm Pages tool ;)

@dillonkearns
Copy link
Owner

Yeah, it depends on your workflow, some CMS tools offer a way to define higher-level widgets that you can embed like that high-level example, which I think is a nice experience for non-technical users because then they don't have to fiddle with low-level HTML and risk getting something wrong. Also you can be more confident about upgrading code because it has less duplication (make a change to the rendering logic for a bandcamp-player widget instead of updating all of the instances of that iframe).

It depends on your workflow, though, and even if I think it's ideal to use these higher-level widgets I definitely would also like to make it possible to embed lower-level HTML for users that want this for whatever reason. I'm not sure when I'll have cycles to work on that, though, but I'd love to discuss possible design ideas more.

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