Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ module.exports =
openPreviewInSplitPane:
type: 'boolean'
default: true
customCSSFile:
title: 'Custom CSS File'
type: 'string'
default: ''
grammars:
type: 'array'
default: [
Expand Down
8 changes: 8 additions & 0 deletions lib/renderer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ render = (text, filePath, callback) ->

html = sanitize(html)
html = resolveImagePaths(html, filePath)

customCSSPath = atom.config.get('markdown-preview.customCSSFile')
if customCSSPath
customCSSPath = customCSSPath
.replace(/^~?\//, (process.env.HOME or '')+'/')
customCSS = fs.readFileSync(customCSSPath, 'utf8')
html += "<style>#{customCSS}</style>"

callback(null, html.trim())

sanitize = (html) ->
Expand Down