Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Add syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbundy committed Nov 25, 2018
1 parent 54e0aa5 commit 9416b78
Show file tree
Hide file tree
Showing 3 changed files with 509 additions and 62 deletions.
15 changes: 15 additions & 0 deletions main-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var LatestUpdate = require('./lib/latest-update')
var ref = require('ssb-ref')
var setupContextMenuAndSpellCheck = require('./lib/context-menu-and-spellcheck')
var watch = require('mutant/watch')
var requireStyle = require('require-style')

module.exports = function (config) {
var sockets = combine(
Expand Down Expand Up @@ -80,6 +81,20 @@ module.exports = function (config) {
})
)

document.head.appendChild(
h('style', {
innerHTML: computed(api.settings.obs.get('patchwork.theme', 'light'), themeName => {
const syntaxThemeOptions = {
light: 'github',
dark: 'monokai'
}

const syntaxTheme = syntaxThemeOptions[themeName] || syntaxThemeOptions['light']
return requireStyle(`highlight.js/styles/${syntaxTheme}.css`)
})
})
)

document.head.appendChild(
h('style', {
innerHTML: computed(api.settings.obs.get('patchwork.fontSize'), size => {
Expand Down
Loading

0 comments on commit 9416b78

Please sign in to comment.