forked from gatsbyjs/gatsby-starter-default
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kurt Harriger
committed
Feb 21, 2016
1 parent
f1e1001
commit 8efa11c
Showing
6 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
module.exports = function(config, env) { | ||
config = config.merge(function(cfg) { | ||
cfg.resolveLoader.modulesDirectories.unshift(`${__dirname}/loaders`); | ||
//cfg.resolve.modulesDirectories.push('/usr/local/lib/node_modules/gatsby/node_modules'); | ||
return cfg; | ||
}); | ||
return config; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import frontMatter from 'front-matter' | ||
import markdownIt from 'markdown-it' | ||
import hljs from 'highlight.js' | ||
import _ from 'underscore' | ||
|
||
const highlight = (str, lang) => { | ||
if ((lang !== null) && hljs.getLanguage(lang)) { | ||
try { | ||
return hljs.highlight(lang, str).value | ||
} catch (_error) { | ||
console.error(_error) | ||
} | ||
} | ||
try { | ||
return hljs.highlightAuto(str).value | ||
} catch (_error) { | ||
console.error(_error) | ||
} | ||
return '' | ||
} | ||
|
||
const md = markdownIt({ | ||
html: true, | ||
linkify: true, | ||
typographer: true, | ||
highlight, | ||
}).use(require('markdown-it-mathjax')); | ||
|
||
module.exports = function (content) { | ||
let body | ||
this.cacheable() | ||
const meta = frontMatter(content) | ||
body = md.render(meta.body) | ||
const result = _.extend({}, meta.attributes, { | ||
body, | ||
}) | ||
this.value = result | ||
return `module.exports = ${JSON.stringify(result)}` | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ module.exports = React.createClass({ | |
|
||
render: function() { | ||
return ( | ||
|
||
<div> | ||
<Container | ||
style={{ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
title: Hi people | ||
--- | ||
Welcome to your new Gatsby site. | ||
|
||
Must have $\pi$ | ||
|