Skip to content

Instantly share code, notes, and snippets.

@zapatoche
Created September 19, 2011 15:37
Show Gist options
  • Select an option

  • Save zapatoche/1226775 to your computer and use it in GitHub Desktop.

Select an option

Save zapatoche/1226775 to your computer and use it in GitHub Desktop.
load markdown with YAML
//in data/test.yml
copy: >
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
body: >
:markdown
But can include **Markdown** using the appropriate Haml filter.
//in the HAML, template
- test = YAML::load(File.open('data/test.yml'))
//doesn't work
= test["body"]
//work
:markdown
#test
test
test
@nathankleyn

Copy link
Copy Markdown

Try using:

= Haml::Engine.new(@post.haml).render(self)

Note that this actually parses the output using the Haml engine as opposed to inserting it directly, which is what you want.

@zapatoche

Copy link
Copy Markdown
Author

Do I use this instead of:
= test["body"]

@zapatoche

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment