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

An option to stop recognizing code by indentations? #167

Closed
tiye opened this issue Jun 4, 2013 · 5 comments
Closed

An option to stop recognizing code by indentations? #167

tiye opened this issue Jun 4, 2013 · 5 comments

Comments

@tiye
Copy link

tiye commented Jun 4, 2013

We are using Marked in a forum: https://github.com/cnodejs/nodeclub/
This might be a strange feature request, but let me explain:

Many programmers in China are not enough familiar with Markdown (many are famliar though). In some topics and posts, code and logs are just pasted like plain text. Code without right formating looks really bad, we were trying to find solution to fix it.

Thinking it is indeed a better experience to paste code directly in a textarea, I sent a PR to display the code in a CSS style white-space: pre-wrap to make writespaces visible, It makes sense that many code that was not markuped look better now with indentation and fixed-with font face.

But there are still problems, for example, for code like this:

code

    code

code

This might be a piece of code that was directly pasted into the content. Since empty lines are present, the line in the middle is recognized as code, and is transformed into a <pre> block. As a result, the code looks strange.


code

code

code


If it is not regarded as code, then it could be plain text, with indentations.
With whitespace: pre-wrap it looks like code (without syntax highlight).
Making Markdown compatible with plain text help people keep focusing on the content rather than the formating.

Meanwhile, as a personal experience, I usually edit my code in a text editor, then copy and paste it to an textarea. Adding indentations is a disguasting step, especially for a forum (much better when using Markdown for blogging).

So I think it is a trick or solution we may rely on to make Markdown better.

@lepture
Copy link
Contributor

lepture commented Jun 4, 2013

@jiyinyiyong Robotskirt is suggested, which is a sundown binding in Node.

@tiye
Copy link
Author

tiye commented Jun 4, 2013

@lepture Did Robotskirt considered this problem and added feature for it?
Options about disabling the indentation syntax are not found in the repo of Robotskirt :(

@lepture
Copy link
Contributor

lepture commented Jun 4, 2013

@jiyinyiyong Github is powered by sundown. And it has a renderer feature. I am introducing renderer to marked at #129

@tiye
Copy link
Author

tiye commented Jun 5, 2013

Judging from the API blockcode: function(code, lang), it seems to be the content that is already parsed and transformed to HTML or something. There are two syntax rules for makign code blocks. How can I tell them from each other with this API?

@joshbruce
Copy link
Member

Closing as merged.

#27

And #129 Because of the reference to speed as the vision.

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

No branches or pull requests

3 participants