You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Markdown.Html.tag "Bio"(\avatar name children ->Bio.view avatar name)|>Markdown.Html.withAttribute "avatar"|>Markdown.Html.withOptioanlAttribute "name"
You may experience confusing behavior if you pass in arguments that are not handled. For example, this will successfully render, but will completely ignore first and last
There are tradeoffs either way. By being explicit, it's less confusing when you are passing something with the wrong argument names. Or if you are building something with a CMS like Netlify CMS, you can cause the build to fail with something like elm-pages, for example, if you pass invalid arguments, so you can get early feedback.
But on the other side, there's the question of compatibility if you are trying to inter-operate with other custom elements that may have some arguments you're not handling yet. It may be reasonable to just have an error here and then let you handle it. But worth considering.
The text was updated successfully, but these errors were encountered:
I understand it is possible to lose power by forcing all attributes to be handled, but I would love to have typos be checked!
Maybe there is something with the best of both worlds? Wouldn't it be possible to implement some function like Markdown.Html.withAllAttributes that gives the list of key-value attribute pairs of all attributes. If it is included, there can't be an error with missing attributes. If it isn't included, any attribute that's not handled causes an error.
What do you think?
withAllAttributes:Renderer(List{ key :String, value :String}-> view)->Renderer view
Right now, if you have an HTML handler like this:
You may experience confusing behavior if you pass in arguments that are not handled. For example, this will successfully render, but will completely ignore
first
andlast
Pros and Cons
There are tradeoffs either way. By being explicit, it's less confusing when you are passing something with the wrong argument names. Or if you are building something with a CMS like Netlify CMS, you can cause the build to fail with something like
elm-pages
, for example, if you pass invalid arguments, so you can get early feedback.But on the other side, there's the question of compatibility if you are trying to inter-operate with other custom elements that may have some arguments you're not handling yet. It may be reasonable to just have an error here and then let you handle it. But worth considering.
The text was updated successfully, but these errors were encountered: