Uh oh!
There was an error while loading. Please reload this page.
Load markdown files through markdown-with-front-matter-loader - #1304
Load markdown files through markdown-with-front-matter-loader#1304pugnascotia wants to merge 1 commit into
Conversation
gaearon
commented
Feb 12, 2017
Thanks for the PR! What does that JSON look like? |
gaearon
commented
Feb 12, 2017
Also, can you provide |
pugnascotia
commented
Feb 13, 2017
Regarding #!/bin/bashset -eo pipefail
test_branch() {
branch="$1"
git checkout "$branch">/dev/null 2>&1
rm -rf build
npm run create-react-app build >/dev/null 2>&1
ls build/node_modules >"$HOME/tmp/cra-$branch-modules.txt"
du -s build/node_modules/
}
MASTER_SIZE=$(test_branch master)
MARKDOWN_SIZE=$(test_branch load-markdown)echo"node_modules size on master: $MASTER_SIZE"echo"node_modules size on load-markdown: $MARKDOWN_SIZE"echoecho"Module diff:"
diff -u "$HOME/tmp/cra-master-modules.txt""$HOME/tmp/cra-load-markdown-modules.txt"Results: Size of new modules: $ cd build/node_modules/
$ du -csh markdown-with-front-matter-loader yaml-front-matter
24K markdown-with-front-matter-loader
592K yaml-front-matter
616K total |
pugnascotia
commented
Feb 13, 2017
Regarding JSON - given some Markdown: ---title: Test markdown postdate: 2015-06-03tags: Badger, Squirrel, Nihilist---# Content
Some contentYou get the following, except the {"title": "Test markdown post","date": "2015-06-03T00:00:00.000Z","tags": "Badger, Squirrel, Nihilist","__content": "<h1 id=\"content\">Content</h1>\n<p>Some content</p>\n"} |
7b46175 to
0910c25Comparegaearon
commented
Feb 13, 2017
What is the benefit of this structure, compared to regular Markdown -> HTML conversion? |
pugnascotia
commented
Feb 13, 2017
The first part can contain any fields you want, so you can use whatever metainfo conventions make sense for your Markdown documents. For example, a tags field (string or YAML array) for categorising a blog post, a field for a blog post's background image, author name, references, anything you like really. You could even pre-process the files at build time to extract the metadata and build some kind of index. That's all separate from the actual markdown content. |
gaearon
commented
Feb 24, 2017
So, I appreciate the PR but I think we'll hold off for now. If we add an exception for If there are more requests for this in the future, we can reconsider this. Sorry! |
This PR adds support for loading
*.mdfiles throughmarkdown-with-front-matter-loader. This makes it simple to load and render Markdown through CRA.Testing
./tasks/cra.sh my-app-testcd my-app-testsrc/_posts/hello-world.md--- title: 'Hello world' --- # Hello world This is a test ```javascript function() { } ```src/App.jsto load the file