1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 10:22:53 +00:00

working with header animations - marked/highlightjs fixes

This commit is contained in:
2016-08-24 23:41:46 -05:00
parent 7b48c79180
commit 07ead1ffc2
12 changed files with 336 additions and 15 deletions

View File

@@ -1,11 +1,13 @@
import React from 'react';
import marked from 'marked';
import highlight from 'highlight.js';
import hljs from 'highlight.js';
const renderer = new marked.Renderer();
marked.setOptions({
header: true,
langPrefix: 'hljs ',
highlight: (code) => {
return highlight.highlightAuto(code).value;
return hljs.highlightAuto(code).value;
}
});
@@ -13,7 +15,7 @@ export default class Post extends React.Component{
render(){
return(
<div class="Preview" dangerouslySetInnerHTML={{__html : marked(this.props.content)}}>
<div class="Preview" dangerouslySetInnerHTML={{__html : marked(this.props.content, {renderer : renderer})}}>
</div>
);
}