mdgriffith / elm-markup

Elm-friendly markup

Home Page:https://package.elm-lang.org/packages/mdgriffith/elm-markup/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non alphanumeric characters in link labels are not allowed

tad-lispy opened this issue · comments

See https://ellie-app.com/427N2gCg3CFa1

The workaround is to escape them with backslashes, but if the content is in-lined in an Elm source file, then the backslash also needs to be escaped, so we end up with code like this:

"[http\\:\\/\\/elm-lang.org\\/](http://elm-lang.org/)"

Perhaps it would be better to allow any character except for ] and newlines as part of the content?

So, links change a bit in v2. Now there is no special syntax, they're just handled as custom inlines.

So, a standard link from Mark.Default looks like

{Link|Here's my label| url = http://elm-lang.org }

Though for the above case you could create a new custom link with different rules.

For example, you could make aJustLink custom inline which just gives the url as the label.

{JustLink| url = http://elm-lang.org }

 Mark.inline "JustLink"
        (\url model ->
            Element.link []
                { url = url
                , label =
                   Element.text url
                }
        )
        |> Mark.inlineString "url"