Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line breaks in md data #286

Closed
MichaelCereda opened this issue May 12, 2016 · 3 comments
Closed

Line breaks in md data #286

MichaelCereda opened this issue May 12, 2016 · 3 comments

Comments

@MichaelCereda
Copy link
Contributor

I'm tying to have a line break (
) within two lines.

---
title: I'm a markdown file!
subtitle: >
          I'm going to keep it
          short, I promise
icon: ghost

---
Markdown is pretty cool if you ask me.

## You can have lists

### Numbered
1. me first!
2. I'm second!
3. third :(

i tryed everything, >, |.
nothings seems to render that

i also followed this blog post but really nothing happens... any idea?
http://push.cwcon.org/learn/yaml-and-markdown.html

@MichaelCereda
Copy link
Contributor Author

i resolved editing the loader

---
title: I'm a markdown file!
subtitle: >
  I'm going to keep it

  short, I promise
icon: ghost
---

editing to

https://github.com/gatsbyjs/gatsby/blob/master/lib/loaders/markdown-loader/index.js#L31

for (var key in meta.attributes){
    if(meta.attributes[key].indexOf('\n')!=-1){
      meta.attributes[key] = meta.attributes[key].replace('\n', '<br />');
    }
  }

@KyleAMathews
Copy link
Contributor

Hmmm yeah the front matter in Gatsby isn't run through the markdown renderer like in that blog post. It looks like your solution works. But instead of forking Gatsby, just override the loader like here https://github.com/gatsbyjs/gatsby-starter-default/blob/master/loaders/markdown-loader/index.js

@MichaelCereda
Copy link
Contributor Author

Yes absolutely... I linked that line so if somebody needs it they won't
have to look around.

On Thu, May 12, 2016, 8:05 PM Kyle Mathews notifications@github.com wrote:

Hmmm yeah the front matter in Gatsby isn't run through the markdown
renderer like in that blog post. It looks like your solution works. But
instead of forking Gatsby, just override the loader like here
https://github.com/gatsbyjs/gatsby-starter-default/blob/master/loaders/markdown-loader/index.js


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#286 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants