Closed redoPop closed 9 years ago
Sorry for the slow response this is really nice. I'm wondering if the yaml shouldn't have a key specific in the yaml to let hologram know it should parse the yaml and markdown.
The idea being that you might have yaml+markdown for generating something else in your project and you wouldn't want hologram to try and create pages off it.
Can do! How does this sound:
---
hologram: true
title: (...etc.)
---
(Markdown body)
hologram: true
, then it is processed by Hologram as a doc block.:md
key to be handled by the default renderer).I think it's good, I was trying to think of something else but that's probably the best option for now. Thanks again for the PR.
Okidoke! I also added an additional fixture for a dummy "jekyll.md" file that doesn't meet the hologram: true
test, and added info about the new key to the readme.
An idea: we could avoid the need for the hologram: true
flag by looking for a combination of the keys title
, name
, and one of parent
/category
/categories
in the YAML. That footprint seems fairly unique; if the markdown contains all three perhaps we can be reasonably confident we're looking at a Hologram configuration.
Allows markdown files to be treated as doc blocks if they open with YAML.
bem.md
source in the previous example. (These files are used for for new tests.)index.md
fixture. Plain markdown files are treated just as they were before.Summary of change:
process_files
now examines the contents of each.md
file to see if its opening lines look like YAML. If so, the file's contents are added to thedoc_block_collection
.Resolves #188 since title can be specified in the YAML configuration.
My own use case is producing a CSS code style guide alongside the pattern style guide – i.e., documentation that doesn't really belong in a Sass/scss file. Using
.md
files for this documentation also makes them readable directly in GitHub, which is a nice bonus.