Added new extensions in markdown sample
This commit is contained in:
parent
83bc227d9a
commit
80d9f8b020
@ -62,6 +62,7 @@ import StickyComment from './gutters/StickyComment';
|
|||||||
import CurrentDiscussion from './gutters/CurrentDiscussion';
|
import CurrentDiscussion from './gutters/CurrentDiscussion';
|
||||||
import FindReplace from './FindReplace';
|
import FindReplace from './FindReplace';
|
||||||
import editorSvc from '../services/editorSvc';
|
import editorSvc from '../services/editorSvc';
|
||||||
|
import markdownConversionSvc from '../services/markdownConversionSvc';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -105,6 +106,7 @@ export default {
|
|||||||
saveSelection: () => editorSvc.saveSelection(true),
|
saveSelection: () => editorSvc.saveSelection(true),
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
markdownConversionSvc.init(); // Needs to be inited before mount
|
||||||
this.updateBodySize();
|
this.updateBodySize();
|
||||||
window.addEventListener('resize', this.updateBodySize);
|
window.addEventListener('resize', this.updateBodySize);
|
||||||
window.addEventListener('keyup', this.saveSelection);
|
window.addEventListener('keyup', this.saveSelection);
|
||||||
|
@ -60,6 +60,10 @@ ol ol {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $link-color;
|
color: $link-color;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
|
@ -15,6 +15,8 @@ Styling
|
|||||||
|
|
||||||
**Strong** __strong__
|
**Strong** __strong__
|
||||||
|
|
||||||
|
==Marked text.==
|
||||||
|
|
||||||
~~Mistaken text.~~
|
~~Mistaken text.~~
|
||||||
|
|
||||||
> Quoted text.
|
> Quoted text.
|
||||||
@ -31,9 +33,12 @@ Lists
|
|||||||
* Item
|
* Item
|
||||||
+ Item
|
+ Item
|
||||||
|
|
||||||
1. Item
|
1. Item 1
|
||||||
2. Item
|
2. Item 2
|
||||||
3. Item
|
3. Item 3
|
||||||
|
|
||||||
|
- [ ] Incomplete item
|
||||||
|
- [x] Complete item
|
||||||
|
|
||||||
|
|
||||||
Links
|
Links
|
||||||
@ -43,6 +48,8 @@ A [link](http://example.com).
|
|||||||
|
|
||||||
An image: ![Alt](img.jpg)
|
An image: ![Alt](img.jpg)
|
||||||
|
|
||||||
|
A sized image: ![Alt](img.jpg =60x50)
|
||||||
|
|
||||||
|
|
||||||
Code
|
Code
|
||||||
---------------------------
|
---------------------------
|
||||||
@ -81,9 +88,9 @@ Definition lists
|
|||||||
Markdown
|
Markdown
|
||||||
: Text-to-HTML conversion tool
|
: Text-to-HTML conversion tool
|
||||||
|
|
||||||
Classeur
|
Authors
|
||||||
: French translation for "Binder"
|
: John
|
||||||
: A Markdown editing app
|
: Luke
|
||||||
|
|
||||||
Footnotes
|
Footnotes
|
||||||
---------------------------
|
---------------------------
|
||||||
|
@ -3,6 +3,7 @@ import Prism from 'prismjs';
|
|||||||
import MarkdownIt from 'markdown-it';
|
import MarkdownIt from 'markdown-it';
|
||||||
import markdownGrammarSvc from './markdownGrammarSvc';
|
import markdownGrammarSvc from './markdownGrammarSvc';
|
||||||
import extensionSvc from './extensionSvc';
|
import extensionSvc from './extensionSvc';
|
||||||
|
import utils from './utils';
|
||||||
|
|
||||||
const htmlSectionMarker = '\uF111\uF222\uF333\uF444';
|
const htmlSectionMarker = '\uF111\uF222\uF333\uF444';
|
||||||
const diffMatchPatch = new DiffMatchPatch();
|
const diffMatchPatch = new DiffMatchPatch();
|
||||||
@ -103,25 +104,23 @@ function hashArray(arr, valueHash, valueArray) {
|
|||||||
return String.fromCharCode.apply(null, hash);
|
return String.fromCharCode.apply(null, hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default options for the markdown converter and the grammar
|
export default {
|
||||||
const defaultOptions = {
|
defaultOptions: null,
|
||||||
abbr: true,
|
defaultConverter: null,
|
||||||
breaks: true,
|
defaultPrismGrammars: null,
|
||||||
deflist: true,
|
|
||||||
del: true,
|
|
||||||
fence: true,
|
|
||||||
footnote: true,
|
|
||||||
linkify: true,
|
|
||||||
math: true,
|
|
||||||
sub: true,
|
|
||||||
sup: true,
|
|
||||||
table: true,
|
|
||||||
typographer: true,
|
|
||||||
insideFences,
|
|
||||||
};
|
|
||||||
|
|
||||||
const markdownConversionSvc = {
|
init() {
|
||||||
defaultOptions,
|
const defaultProperties = { extensions: utils.computedPresets.default };
|
||||||
|
|
||||||
|
// Default options for the markdown converter and the grammar
|
||||||
|
this.defaultOptions = {
|
||||||
|
...extensionSvc.getOptions(defaultProperties),
|
||||||
|
insideFences,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.defaultConverter = this.createConverter(this.defaultOptions);
|
||||||
|
this.defaultPrismGrammars = markdownGrammarSvc.makeGrammars(this.defaultOptions);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a converter and init it with extensions.
|
* Creates a converter and init it with extensions.
|
||||||
@ -270,8 +269,3 @@ const markdownConversionSvc = {
|
|||||||
).join('');
|
).join('');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
markdownConversionSvc.defaultConverter = markdownConversionSvc.createConverter(defaultOptions);
|
|
||||||
markdownConversionSvc.defaultPrismGrammars = markdownGrammarSvc.makeGrammars(defaultOptions);
|
|
||||||
|
|
||||||
export default markdownConversionSvc;
|
|
||||||
|
@ -66,6 +66,7 @@ Object.keys(presets).forEach((key) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
computedPresets,
|
||||||
cleanTrashAfter: 7 * 24 * 60 * 60 * 1000, // 7 days
|
cleanTrashAfter: 7 * 24 * 60 * 60 * 1000, // 7 days
|
||||||
origin,
|
origin,
|
||||||
oauth2RedirectUri: `${origin}/oauth2/callback`,
|
oauth2RedirectUri: `${origin}/oauth2/callback`,
|
||||||
|
Loading…
Reference in New Issue
Block a user