-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Markdown new line " " (double space) converts to "\" #512
Comments
@bert-bruggeman Is this with the current editor, or with the preview of the slate editor? |
Current editor,... |
The slate editor from #254 is about to be merged. I can't seem to reproduce this in Slate, so that's good. If you want to have a try, look at https://deploy-preview-254--cms-demo.netlify.com/. I might just not be understanding the error you're mentioning.. |
@tortilaman In the current editor, this only works if the text is displayed as markdown code, in wysiwyg mode double spaces are replaced by a backslash and the text is not on a new line... In the new slate editor, the double spaces do not work at all (not in the content preview as well). |
@bert-bruggeman Alright, I would assume it's preferable to not have the slash, so that's probably good. I'm curious if it's the markdown library itself that doesn't support the double space syntax. |
It looks like the reason this is broken in the new Slate editor is because of these lines in #254: /**
* Turn off soft breaks until we can properly support them across both
* editors.
*/
pull(this.Parser.prototype.inlineMethods, 'break'); |
@tech4him1 good eye :) The issue is that a soft break is a distinct entity in the Markdown AST we're using, and there's no obvious way to express that entity in the Slate AST. Just need to dig in more and find the right approach. As always, contributions are welcome! |
@bert-bruggeman a break can be accomplished in markdown via double space or backslash. The AST we use for markdown doesn't carry specifics, just abstract meaning - to wit, the AST doesn't know how the break was made. In other words, both a trailing double space and a trailing slash translate into the same "soft break" entity when the markdown is parsed to an abstract syntax tree. When we convert that back to a markdown string, we don't know which method was used to create the soft break, so we always output it the same way, as a slash. The good new is, both styles are now supported in the new editor, which is on master and soon to be released. |
Sorry for bothering you with this issue a year later, but the Netlify CMS Markdown editor is still outputting line breaks as a backslash for me. The result in Jekyll (which uses Kramdown) is a \ in the middle of the text, instead of a You wrote Is this the case? Is there any way I can add support for a double space, instead of a backslash? Sorry in advance if I am missing the obvious solution, but I couldn't find a way to force Kramdown to grudgingly accept the backslash line break notation. For reference, I'm using Netlify CMS version 2.0.0 (https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js) Thank you! |
We output commonmark compatible markdown, but Kramdown doesn't really adhere to the commonmark spec. There should be ways to configure our markdown widget's output, though, definitely worth discussing. |
Hmm looks like turning off the |
@ouarez have you found a solution when using kramdown with netlify-cms? |
Bump for this. Jigsaw utilises Parsedown which does not appear to work with backslash newlines. Having to train editors into using a double space is no mean feat when they just expect to type and everything "works". In summary: it should be possible to configure which line break is used - " |
I think the config options should include a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still our single biggest issue our editors experience. |
Is there meanwhile a solution to this problem? |
I've been struggling with this one also. I've implemented some simple regex to get around it:
This just takes any html that is Seems to work ok in my case, maybe this is helpful for others viewing this ticket. |
Works like a charm. Thanks! |
hi all where i add this ? |
Markdown new line " " (double space) converts to a backslash in the markdown editor....
The text was updated successfully, but these errors were encountered: