Created
September 19, 2011 15:37
-
-
Save zapatoche/1226775 to your computer and use it in GitHub Desktop.
load markdown with YAML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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 |
Author
Do I use this instead of:
= test["body"]
Author
The answer is actually:
test
== Maruku.new(@copy).to_html
http://stackoverflow.com/questions/7562784/ruby-slim-parse-markdown-from-a-yaml-file/7572000#7572000
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try using:
Note that this actually parses the output using the Haml engine as opposed to inserting it directly, which is what you want.