Elm-format: Non-idempotent URL formatting

Created on 29 Aug 2018  路  4Comments  路  Source: avh4/elm-format

This is on elm-format-0.19 0.8.0

SSCCE

module Foo exposing (foo)

{-| An SSCCE

[https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media\_features](https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media_features)

-}


foo : Int
foo =
    5

Running elm-format on this "double wraps" the URL from this:

[https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media\_features](https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media_features)

...to this:

[[https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media\_features](https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media_features)](https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media_features)

The outputted file looks like this:

module Foo exposing (foo)

{-| An SSCCE

[[https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media\_features](https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media_features)](https://developer.mozilla.org/en-US/docs/Web/CSS/@media#Media_features)

-}


foo : Int
foo =
    5

Running it again doubles that...and so forth.

bug duplicate

All 4 comments

(and thanks for the detailed report!)

A possible workaround might be to replace _ in the url with %5F, though I'm not familiar enough with the URL/HTTP spec to know if that's actually valid to do, but the thing triggering this bug is the underscore in the URL, which is incorrectly being markdown escaped due to some recent code that fixes a different bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

conradwt picture conradwt  路  8Comments

rtfeldman picture rtfeldman  路  8Comments

mordrax picture mordrax  路  6Comments

avh4 picture avh4  路  5Comments

ahstro picture ahstro  路  3Comments