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

Backslash prepended to underscores in comments #587

TeodoroFilippini opened this Issue Dec 24, 2018 · 2 comments


2 participants
Copy link

TeodoroFilippini commented Dec 24, 2018

I have a type alias definition in the following form:

{-| represents a diary, as returned by the endpoint api/get_diary.

type alias Diary =
     { notes : String
     , pages : Int     

Elm-format converts the comment to the following:

{-| represents a diary, as returned by the endpoint api/get\_diary.

I understand the usefulness of such rule in the code - but it should be ignored in comments.


This comment has been minimized.

Copy link

avh4 commented Dec 26, 2018

This is basically the same issue as #540. The backslash is added because _ is a special character in markdown, and is required to be escaped in certain contexts. (In your example, the backslash is not necessary, but it is also allowed, and will still render the way you originally intended.)

I'd be happy to accept a PR that makes the markdown formatting smarter so that it only adds the backslash when necessary.

An option you can consider currently is to use backticks around the endpoint path (the current formatter knows that underscores do not need to be escaped in that context).

{-| represents a diary, as returned by the endpoint `api/get_diary`.

@avh4 avh4 added the help wanted label Dec 26, 2018


This comment has been minimized.

Copy link

TeodoroFilippini commented Jan 7, 2019

@avh4 thank you for the explanation. I will employ the workaround you propose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment