diff options
author | Christoph (Sheogorath) Kern | 2018-11-24 17:35:53 +0100 |
---|---|---|
committer | GitHub | 2018-11-24 17:35:53 +0100 |
commit | 4856aa2840fb60f1dda59e164fe4937e93d4b312 (patch) | |
tree | fa5ae912156aeeebe64cbe115806b1b5d00e4537 /public | |
parent | 6d0c3ccd23e445a31bd6aa5fd8639479f98a5699 (diff) | |
parent | 33774c11b989a6a8aa2517e1a83d39c43741fc90 (diff) |
Merge pull request #1069 from SISheogorath/fix/to-markdown
Update from to-markdown to turndown
Diffstat (limited to 'public')
-rw-r--r-- | public/js/index.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/public/js/index.js b/public/js/index.js index c2969e92..a845b5d3 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -12,7 +12,7 @@ require('../css/site.css') require('highlight.js/styles/github-gist.css') -import toMarkdown from 'to-markdown' +import TurndownService from 'turndown' import { saveAs } from 'file-saver' import randomColor from 'randomcolor' @@ -1498,7 +1498,12 @@ $('#snippetExportModalConfirm').click(function () { }) function parseToEditor (data) { - var parsed = toMarkdown(data) + var turndownService = new TurndownService({ + defaultReplacement: function (innerHTML, node) { + return node.isBlock ? '\n\n' + node.outerHTML + '\n\n' : node.outerHTML + } + }) + var parsed = turndownService.turndown(data) if (parsed) { replaceAll(parsed) } } |