Added turndown settings

This commit is contained in:
Benoit Schweblin 2018-02-25 15:41:25 +00:00
parent 0b74d48bc8
commit 57f45f0c5f
3 changed files with 19 additions and 13 deletions

View File

@ -28,13 +28,9 @@ import TurndownService from 'turndown/lib/turndown.browser.umd';
import htmlSanitizer from '../../libs/htmlSanitizer';
import MenuEntry from './common/MenuEntry';
import providerUtils from '../../services/providers/providerUtils';
import store from '../../store';
const turndownService = new TurndownService({
headingStyle: 'atx',
hr: '----------',
bulletListMarker: '-',
codeBlockStyle: 'fenced',
});
const turndownService = new TurndownService(store.getters['data/computedSettings'].turndown);
const readFile = file => new Promise((resolve) => {
if (file) {

View File

@ -59,6 +59,19 @@ pandoc:
toc: true
tocDepth: 3
# HTML to Markdown converter options
# See https://github.com/domchristie/turndown
turndown:
headingStyle: atx
hr: ----------
bulletListMarker: '-'
codeBlockStyle: fenced
fence: '```'
emDelimiter: _
strongDelimiter: '**'
linkStyle: inlined
linkReferenceStyle: full
# Default content for new files
newFileContent: |

View File

@ -1,13 +1,7 @@
import DiffMatchPatch from 'diff-match-patch';
import TurndownService from 'turndown/lib/turndown.browser.umd';
import htmlSanitizer from '../../libs/htmlSanitizer';
const turndownService = new TurndownService({
headingStyle: 'atx',
hr: '----------',
bulletListMarker: '-',
codeBlockStyle: 'fenced',
});
import store from '../../store';
function cledit(contentElt, scrollEltOpt) {
const scrollElt = scrollEltOpt || contentElt;
@ -114,6 +108,7 @@ function cledit(contentElt, scrollEltOpt) {
function focus() {
selectionMgr.restoreSelection();
contentElt.focus();
}
function addMarker(marker) {
@ -337,6 +332,8 @@ function cledit(contentElt, scrollEltOpt) {
adjustCursorPosition();
});
const turndownService = new TurndownService(store.getters['data/computedSettings'].turndown);
contentElt.addEventListener('paste', (evt) => {
undoMgr.setCurrentMode('single');
evt.preventDefault();