Giter Site home page Giter Site logo

Comments (10)

tommoor avatar tommoor commented on May 22, 2024

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.

smeijer avatar smeijer commented on May 22, 2024

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.

hecor avatar hecor commented on May 22, 2024

Thanks @tommoor and @smeijer, what's the easiest way to remove this feature, any suggestions ?

from rich-markdown-editor.

smeijer avatar smeijer commented on May 22, 2024

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.

tommoor avatar tommoor commented on May 22, 2024

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.

hecor avatar hecor commented on May 22, 2024

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.

smeijer avatar smeijer commented on May 22, 2024

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.

anniebabannie avatar anniebabannie commented on May 22, 2024

@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.

tommoor avatar tommoor commented on May 22, 2024

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.

anniebabannie avatar anniebabannie commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.