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:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user