Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !1304

Load markdown files through markdown-with-front-matter-loader

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/pugnascotia/load-markdown into master Dec 21, 2016
  • Overview 7
  • Commits 1
  • Pipelines 0
  • Changes 3

Created by: pugnascotia

This PR adds support for loading *.md files through markdown-with-front-matter-loader. This makes it simple to load and render Markdown through CRA.

Testing

  1. Create a demo app with ./tasks/cra.sh my-app-test
  2. cd my-app-test
  3. Create src/_posts/hello-world.md
---
title: 'Hello world'
---
# Hello world

This is a test

```javascript
function() { }
```
  1. Modify src/App.js to load the file
import post from './_pages/hello-world.md';
  1. Include the post in the page:
<p className="App-intro">
  To get started, edit <code>src/App.js</code> and save to reload.
</p>
<div dangerouslySetInnerHTML={{__html: post.__content}}></div>
  1. Start dev mode and check the page renders as expected.
yarn start
  1. Build a production bundle:
yarn run build
  1. Check that the production build works as expected by serving it and browsing http://localhost/
docker run -it --rm -v $PWD/build:/usr/share/nginx/html -p 80:80 nginx:alpine
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/pugnascotia/load-markdown