Codeblocks are broken
I've either missed something fundamental or it's simply a bug, but blocks of code gets stripped of their indentation and linebreaks
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 10 Aug, 2013 01:29 PM
Please post a sample file that this happens on.
-Brett
2 Posted by Tomas on 11 Aug, 2013 08:04 AM
https://raw.github.com/chjj/marked/master/README.md
I've also tried creating my own files in sublime edit and byword without success.
However, I apparently missed the option "Convert fenced code blocks" which "fixes the problem". Though I am unsure if it's a feature (to remove the line breaks) or a bug?
Support Staff 3 Posted by Brett on 11 Aug, 2013 11:49 AM
Fenced code blocks are _not_ part of standard Markdown, and can lead to unexpected behavior for non-Github users. Thus it's off by default, though I may give up on that line of thought eventually.
4 Posted by Erik on 23 Sep, 2013 07:10 PM
I also have an issue with code blocks. When i have the code block in the bottom of the document where i intend to use it it does not work, but when i paste the exact same code block into a new document it works as expected.
Support Staff 5 Posted by Brett on 23 Sep, 2013 07:14 PM
You'll need to provide an example for testing.
6 Posted by Erik Thue on 23 Sep, 2013 07:25 PM
Hi,
Here is my examle:
The code block in question:
```Autohotkey
~LWin Up:: return
RWin::RButton
Return
```
When i paste the code block in a new document it renders correctly:
When i use it in the current document:
Used in the attached document:
I did not include this information in the post since i did not want this published.
Regards
Erik Thue
Support Staff 7 Posted by Brett on 23 Sep, 2013 07:35 PM
Opening your file directly renders as: http://ckyp.us/Hhtu
Does your document use any Windows line endings or anything?
-Brett
8 Posted by Erik Thue on 23 Sep, 2013 07:47 PM
It does not render correctly for me even when i open it directly in marked. Same problem...
Is it my settings:
or version:
Settings was set from an article on your site: http://support.markedapp.com/kb/how-to-tips-and-tricks/using-marked-with-github-flavored-markdown-and-syntax-highlighting.
Any suggestions?
Regards
Erik Thue
Support Staff 9 Posted by Brett on 23 Sep, 2013 07:54 PM
Your settings are fine. Was this file edited on Windows, though? The \r line endings may be affecting the code block parsing. Like I said, the file opens fine for me in Marked 1.4.3 using the same settings, so there must be something else going on with the file as you read it. What editor are you working in?
-Brett
10 Posted by Erik Thue on 23 Sep, 2013 08:02 PM
Hm,
It might have created the file on windows and used dropbox sync and continued editing on my mac.
If that is the case i would still like marked to be able to handle it.
I will look at the line endings and see if there is anyting weird going on.
Regards
Erik Thue
11 Posted by Erik Thue on 23 Sep, 2013 08:04 PM
Changing the line endings using the line ending package for sublime fixed the problem.
Thanks for you help.
Regards
Erik Thue