Comments (10)
This is due to the markdown parser interpreting paragraphs indented by several spaces as code, which is definitely a standard.
I think the answer is to remove that from the parsing engine, it won't work with imported documents that use this formatting then but they can be easily fixed in the editor.
from rich-markdown-editor.
It's a feature, not a bug.
I agree with @tommoor. Hmm, I don't agree. It's part of the standard, and thereby should not be changed.
Most of the times, I use backticks `
to wrap code. But plenty of sites use the four space indent formatting. (Reddit for example).
from rich-markdown-editor.
Thanks @tommoor and @smeijer, what's the easiest way to remove this feature, any suggestions ?
from rich-markdown-editor.
Easiest way is change your behavior in writing docs.
Second easiest, would a css style override to make it visually look like normal (indented) text to you, qualify?
from rich-markdown-editor.
Hey @smeijer , please don't misquote me!
Whilst it is a feature of the Markdown standard to use spaces to indent code, this editor is not aiming to be an editor for any Markdown that you can throw at it – only the subset of valid Markdown that it produces.
I DO think that as the editor will never produce code indented with spaces (only backticks), that this parsing should be removed. As I mentioned, in the rare case that someone imports a doc with spaces then it is easily fixed either manually, or as part of the import process.
The code in question is around here:
https://github.com/tommoor/slate-md-serializer/blob/master/src/parser.js#L71
from rich-markdown-editor.
Thanks @tommoor, I removed this feature according to your suggestion. I should inform you the use cases. In Chinese, we often use blanks at the beginning of a paragraph.
Thanks again.
from rich-markdown-editor.
Hey @smeijer, please don't misquote me!
Sorry, about that. That wasn't on purpose. I totally misread your comment, and fixed mine by now.
Turns out, I don't agree with that post of you. But I do understand your addition.
in the rare case that someone imports a doc with spaces then it is easily fixed either manually, or as part of the import process.
I can agree with that.
from rich-markdown-editor.
@smeijer or @hecor Do either of you know where this behavior is set in ProseMirror (since we've moved away from Slate)? I realize converting tabs or spaces to code blocks is expected behavior in some editors, but I'd love to know how to change this so users could put tabs in front of paragraphs (think school essays, or novels). It's just a style preference I'd like to offer, but I'm not sure where to tweak this behavior.
Any and all help is much appreciated 🙏
from rich-markdown-editor.
Honestly I'd consider it a bug now that 4 spaces at the beginning of a paragraph becomes code when you reload, but lets create a new issue as this is so old.
from rich-markdown-editor.
Hmmm I can no longer reproduce the issue actually, weird! If it comes back I'll report it as a bug, but honestly I think I might try to tackle this with CSS anyway, to avoid polluting the original document with extra characters.
from rich-markdown-editor.
Related Issues (20)
- Clicking on webpage outside the editor does not dismiss style popup
- Blinking cursor should always be on after cursor movement HOT 3
- Shift+Enter in code fence could preserve indentation
- Create link with '/' command will cause Uncaught TypeError: assert_1.default is not a function HOT 4
- `/` command does not create new line, it rewrites the above or next line HOT 1
- Menu icon is not hidden after collapsing an heading in the editor
- Toggle todolist in new line with text after HOT 1
- composing lost when select multi lines
- Content of an info notice spills outside container when content includes a code snippet HOT 1
- Table will break if you click on table row action other than the first one HOT 2
- Editor does not show nested lists correctly (bulleted in ordered) HOT 2
- Editor crashes when feeding custom searchLinks HOT 2
- NextJS fails to compile due to global CSS dependency in node modules HOT 1
- Hyperlinks are posted between < >'s HOT 3
- onChange called on init when view == null HOT 1
- onBlur is called on first mount
- Editor state does not update when new value is an empty string
- Double characters being inserted at every line beginning - Firefox Mobile
- whole project crashing and getting `duplicate use of selection JSON ID cell` error HOT 3
- First table row gets converted into table header
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rich-markdown-editor.