Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Broken option "Keep Markdown Line Break Whitespace" #166

Closed
1 task done
claudiofantacci opened this issue Oct 23, 2017 · 8 comments
Closed
1 task done

Broken option "Keep Markdown Line Break Whitespace" #166

claudiofantacci opened this issue Oct 23, 2017 · 8 comments

Comments

@claudiofantacci
Copy link

Prerequisites

Description

Keep Markdown Line Break Whitespace does not work with the option Removing Trailing Whitespace, even though the documentation says that "[...]. Enable this option to keep this whitespace in Markdown files, even if other settings would remove it.".

Steps to Reproduce

  1. Enable both options
  2. Write two lines having the first with two trailing spaces (i.e. you want to break line)
  3. Save

Expected behavior:
Trailing spaces should not be removed because of the option Keep Markdown Line Break Whitespace.

Actual behavior:
Trailing spaces are removed.

Reproduces how often:
Always.
You have to disable Removing Trailing Whitespace or use system-scoped properties.

Versions

macOS 10.12.6

Atom : 1.21.1
Electron: 1.6.15
Chrome : 56.0.2924.87
Node : 7.4.0

apm 1.18.5
npm 3.10.10
node 6.9.5 x64
python 2.7.10
git 2.13.0

@Ben3eeE
Copy link

Ben3eeE commented Oct 24, 2017

Thank you for the report!

I have a few questions to check if this is a duplicate of #137

  • Do you have the language-gfm package enabled?
  • Do you have the grammar of the file set to GitHub Markdown?

@claudiofantacci
Copy link
Author

claudiofantacci commented Oct 24, 2017

Hi @Ben3eeE,

let's go in order.

Do you have the language-gfm package enabled?

It is disabled in my Atom settings (...and I was unaware of it!).
I made this tests:

Do you have the grammar of the file set to GitHub Markdown?

I guess that the answer is Yes. And I elaborate more your two questions with the following table.

Keep Markdown Line Break Whitespace always ON

Safe Mode language-markdown language-gfm Removing Trailing Whitespace Result
ON OFF OFF OFF Present
ON OFF OFF ON Trimmed
ON OFF ON OFF Present
ON OFF ON ON Present
OFF OFF OFF OFF Present
OFF OFF OFF ON Trimmed
OFF OFF ON OFF Present
OFF OFF ON ON Trimmed
OFF ON OFF OFF Present
OFF ON OFF ON Trimmed
OFF ON ON OFF Present
OFF ON ON ON Trimmed

IMHO, the bold-faced Results are wrong, but with different comment on each:

  • OFF | OFF | ON | ON this should always work, note in fact that ON | OFF | ON | ON keep whitespaces
  • OFF | ON | OFF | ON this may not be working because of incompatibility with 3rd party language-markdown
  • OFF | ON | ON | ON this should work because language-gfm is enabled and should (right?) have some sort of precedence over language-markdown

@Ben3eeE
Copy link

Ben3eeE commented Oct 24, 2017

It is disabled in my Atom settings (...and I was unaware of it!).

Yes language-markdown disables language-gfm. I believe there is some setting for this in the language-markdown package

OFF | OFF | ON | ON this should always work

I agree however there might be some other package the interferes with the setting. Try this:

  1. Disable language-markdown
  2. Enable language-gfm
  3. Close any open markdown files
  4. Restart Atom
  5. Check if the setting works

This should force the Grammar to be set correctly.

OFF | ON | OFF | ON this may not be working because of incompatibility with 3rd party language-markdown

Yes.

OFF | ON | ON | ON this should work because language-gfm is enabled and should (right?) have some sort of precedence over language-markdown

No it doesn't have precedence over language-markdown. This is determined by the Grammar. If it's set to GitHub Markdown the setting should work. language-markdown has it's own scopes defined in the grammar which are not included by this setting.

And there is a bug report for this: #137

@claudiofantacci
Copy link
Author

No it doesn't have precedence over language-markdown. This is determined by the Grammar. If it's set to GitHub Markdown the setting should work. language-markdown has it's own scopes defined in the grammar which are not included by this setting.

Ok, good to know this for the future.

I agree however there might be some other package the interferes with the setting. Try this:

Disable language-markdown
Enable language-gfm
Close any open markdown files
Restart Atom
Check if the setting works

It works! I'll keep this configuration then.
The issue is related to language-markdown, I'll discuss this with them.

Thanks for the support!

@Ben3eeE
Copy link

Ben3eeE commented Oct 24, 2017

Thanks for the support!

You're welcome 🙂

@evilmtv
Copy link

evilmtv commented Apr 13, 2018

@claudiofantacci Issue still persists, switching to language-gfm seems to be the only way.
Did you manage to bring it up with language-markdown?

@Ben3eeE
Copy link

Ben3eeE commented Apr 13, 2018

@evilmtv The issue on language-markdown is here burodepeper/language-markdown#200. You may want to check there for updates 🙂

@samuraijane
Copy link

samuraijane commented Apr 10, 2019

For others who may read this in 2019 or later. I am using Atom 1.35.1. I had installed language-markdown (which disabled language-gfm). After removing language-markdown and re-enabling language-gfm, Atom was still removing the 2-space trailing whitespace in my .md files. The solution, as noted by @Ben3eeE, was to close the open tabs of the .md files and restart Atom. After doing this, the 2-space trailing whitespace persists in my .md files. Restarting Atom without closing the tabs had no effect. Be sure to close your tabs.

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

No branches or pull requests

4 participants