Skip to content

Commit

Permalink
Enable content highlighting within code-blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasBaskys committed Jan 5, 2019
1 parent a048019 commit ef28061
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"consistent-return": "off",
"comma-dangle": "off",
"generator-star-spacing": "off",
"import/first": "off",
"import/no-unresolved": "error",
"import/no-extraneous-dependencies": "off",
"jsx-a11y/anchor-is-valid": "off",
Expand Down
2 changes: 2 additions & 0 deletions app/components/tools/Editor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
import { shell } from 'electron';
import React from 'react';
import './highlight';
import ReactQuill, { Quill } from 'react-quill';
import ImageResize from 'quill-image-resize-module';
import className from 'classnames';
Expand Down Expand Up @@ -258,6 +259,7 @@ class Editor extends React.Component<Props> {
*/
Editor.modules = {
toolbar: '#toolbar',
syntax: true,
imageResize: {
displaySize: true
},
Expand Down
11 changes: 11 additions & 0 deletions app/components/tools/highlight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import hljs from 'highlight.js/lib/highlight';
import javascript from 'highlight.js/lib/languages/javascript';
import ruby from 'highlight.js/lib/languages/ruby';
import python from 'highlight.js/lib/languages/python';
import 'highlight.js/styles/monokai.css';

window.hljs = hljs;

hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('ruby', ruby);
hljs.registerLanguage('python', python);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"electron-redux": "^1.3.1",
"electron-updater": "^3.1.2",
"font-awesome": "^4.7.0",
"highlight.js": "^9.13.1",
"history": "^4.7.2",
"jquery": "^3.3.1",
"quill-image-resize-module": "^3.0.0",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5265,6 +5265,11 @@ hawk@~6.0.2:
hoek "4.x.x"
sntp "2.x.x"

highlight.js@^9.13.1:
version "9.13.1"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.13.1.tgz#054586d53a6863311168488a0f58d6c505ce641e"
integrity sha512-Sc28JNQNDzaH6PORtRLMvif9RSn1mYuOoX3omVjnb0+HbpPygU2ALBI0R/wsiqCb4/fcp07Gdo8g+fhtFrQl6A==

highlight.js@^9.3.0:
version "9.12.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e"
Expand Down

0 comments on commit ef28061

Please sign in to comment.