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

Indentation problem with fenced code blocks in Markdown #16

Closed
SachaG opened this issue Apr 7, 2013 · 9 comments
Closed

Indentation problem with fenced code blocks in Markdown #16

SachaG opened this issue Apr 7, 2013 · 9 comments

Comments

@SachaG
Copy link

SachaG commented Apr 7, 2013

I'm using middleman-syntax with Redcarpet to get GitHub-style code blocks and everything's working fine, except that the indentation is off, as you can see here:

http://tmb-middleman.herokuapp.com/2013/02/20/a-look-at-a-meteor-template/

The same problem was also reported on Stack Overflow but in that case the code block was inside HAML whereas here it's inside Markdown.

Here is my config.rb file:

activate :syntax

set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :smartypants => true
@bhollis
Copy link
Contributor

bhollis commented Apr 7, 2013

What does your layout file look like? Is that really your whole config.rb?

@bhollis
Copy link
Contributor

bhollis commented Apr 7, 2013

It looks like I solved this on my own blog by putting this in the article layout:

.post-content= find_and_preserve do
  = yield

It just works around Haml's overwhelming desire to indent everything.

@SachaG
Copy link
Author

SachaG commented Apr 7, 2013

Awesome, it works! So it's the same HAML problem after all, I just didn't think it would affect the markdown code inside another file too!

Thanks again :)

@dansowter
Copy link
Contributor

Thanks very much for this tip. This was driving me crazy.

@thattommyhall
Copy link

I found I could not get

    .container.menu--push= find_and_preserve do
      = yield

to work, but

    .container.menu--push
      ~ yield

(~ in place of =) did.

How bloody annoying!

@doolin
Copy link

doolin commented Apr 4, 2015

@thattommyhall ~ yield worked for me as well. Thanks!

@xavdid
Copy link

xavdid commented Jul 12, 2016

For those just finding this, worth noting that haml's ~ is just an = with #find_and_preserve run: http://haml.info/docs/yardoc/file.REFERENCE.html#whitespace_preservation

@xavibenjamin
Copy link

Thank you!! Was just having problems with this.

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

7 participants