fix highlighting on posts and pages

This commit is contained in:
Nick Pegg 2017-10-07 21:00:04 -07:00
parent 7e838f31ec
commit 5a94ee35e6
3 changed files with 11 additions and 5 deletions

View file

@ -1,3 +1,4 @@
import hljs from 'highlight.js';
import React, { Component } from 'react';
import Icon from 'react-fontawesome';
import Markdown from 'react-markdown';
@ -34,6 +35,12 @@ class Article extends Component {
);
}
componentDidMount() {
document.querySelectorAll('pre code').forEach(elm => {
hljs.highlightBlock(elm);
});
}
postLink() {
let date = new Date(this.props.article.date);
let year = date.getUTCFullYear();