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

Trailing whitespace in block comments should be preserved. #2450

Closed
3 tasks
nojaf opened this issue Aug 29, 2022 · 1 comment
Closed
3 tasks

Trailing whitespace in block comments should be preserved. #2450

nojaf opened this issue Aug 29, 2022 · 1 comment

Comments

@nojaf
Copy link
Contributor

nojaf commented Aug 29, 2022

Issue created from fantomas-online

Code

(**
## Auxiliary settings
Lorep ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisi vel consectetur interdum, nisi nisi consectetur nisl, eget consectetur nisl nisi vel nisi.
#### <fantomas-setting-icon type="orange"></fantomas-setting-icon>indent_size
` indent_size` has to be between 1 and 10.

This preference sets the indentation
The common values are 2 and 4. 
The same indentation is ensured to be consistent in a source file.  
Default = 4.
*)

Result

(**
## Auxiliary settings
Lorep ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisi vel consectetur interdum, nisi nisi consectetur nisl, eget consectetur nisl nisi vel nisi.
#### <fantomas-setting-icon type="orange"></fantomas-setting-icon>indent_size
` indent_size` has to be between 1 and 10.

This preference sets the indentation
The common values are 2 and 4.
The same indentation is ensured to be consistent in a source file.
Default = 4.
*)

Problem description

In fsdocs you can write markdown inside block comments.
Markdown will insert a <br /> tag when you have two or more trailing whitespaces.

Fantomas currently strips these whitespaces after formatting.
Hard to see in this example but The common values are 2 and 4. had two spaces after it in the source, but does not in the formatted result.

Extra information

  • The formatted result breaks my code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas master branch at 2022-08-29T06:38:45Z - b586014

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@nojaf
Copy link
Contributor Author

nojaf commented Aug 29, 2022

@alanlomeli I believe the trimming in

| h :: tail -> String.empty :: (h.TrimEnd()) :: tail

should be removed here. Could you investigate this a bit? You can add a unit test to CommentTests.fs.

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

No branches or pull requests

1 participant