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