Improve highlighting and linking

This commit is contained in:
Peter Stuifzand 2020-06-15 22:39:16 +02:00
parent 1637cc2056
commit bbb6b44416

View File

@ -14,7 +14,11 @@ import getCaretCoordinates from './caret-position'
import moment from 'moment' import moment from 'moment'
import PrismJS from 'prismjs' import PrismJS from 'prismjs'
import 'prismjs/components/prism-php' import 'prismjs/components/prism-php'
import 'prismjs/components/prism-go'
import 'prismjs/components/prism-perl'
import 'prismjs/components/prism-css'
import 'prismjs/components/prism-markup-templating' import 'prismjs/components/prism-markup-templating'
import 'prismjs/components/prism-jq'
import './styles.scss'; import './styles.scss';
import '../node_modules/jquery-contextmenu/dist/jquery.contextMenu.css'; import '../node_modules/jquery-contextmenu/dist/jquery.contextMenu.css';
@ -174,14 +178,16 @@ $(document).on('popup:selected', '#autocomplete', function (event, linkName, res
}) })
if (holder) { if (holder) {
const MD = new MarkdownIt() const MD = new MarkdownIt({
linkify: true
})
MD.use(MarkdownItWikilinks({ MD.use(MarkdownItWikilinks({
baseURL: holder.dataset.baseUrl, baseURL: holder.dataset.baseUrl,
uriSuffix: '', uriSuffix: '',
relativeBaseURL: '/edit/', relativeBaseURL: '/edit/',
htmlAttributes: { htmlAttributes: {
class: 'wiki-link' class: 'wiki-link'
} },
})).use(MarkdownItMark) })).use(MarkdownItMark)
const options = { const options = {
@ -317,6 +323,7 @@ if (holder) {
} }
if (searchEnabled && event.key === 'Escape') { if (searchEnabled && event.key === 'Escape') {
searchEnabled = false searchEnabled = false
return false;
} }
let value = input.value let value = input.value