Created
May 23, 2016 10:56
-
-
Save rsxdalv/0bbcf8d48a710e10f64f22276be1570e to your computer and use it in GitHub Desktop.
Hacky solution to import .md docs into a gh-page page (w/o front matter)
This file contains 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
--- | |
files: | |
- game/all/GET.md | |
- player/ranking/all/GET.md | |
- player/ranking/GET.md | |
- rotation/min/GET.md | |
- rotation/GET.md | |
- static/legends/id/GET.md | |
- static/realms/GET.md | |
- static/server/GET.md | |
- static/tiers/GET.md | |
- static/weapons/GET.md | |
- stats/tiers/GET.md | |
layout: default | |
title: Proposed Brawlhalla API | |
--- | |
{% for file in page.files %} | |
{% capture my-include %} | |
{% include_relative {{file | prepend: 'proposed/'}}%} | |
{% endcapture %} | |
{{ my-include | strip | markdownify }} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context: The repo is used for specs (proposed if you may care) that consist of markdown files describing those specs, keeping the relation between RESTful paths and their documentation simple and easy to navigate. But, in order to flatten and present the specs, using gh-pages jekyll seemed (hindsight - wasn't) optimal. So I created a page that pulls in the list of markdown files provided and outputs them to a landing page. Because I dislike boilerplate and lack of portability, I made it so that YAML FrontMatter would not be needed in headers of the spec files which are supposed to be viewable outside of this context.
Line: comment
2: In my current state, having an array of files is OK.
19. With the prepend, I am able to eliminate shared path
21: strip filter removes the additional whitespace that capture produces.
NB: The files need to be very well formatted markdown. Things like # Heading \n #Heading will not pass, only # Heading \n\n # Heading