mirror of https://github.com/status-im/codimd.git
As vscode-markdownlint behavior
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
parent
ad6f82c9f6
commit
f2912efd25
|
@ -29,12 +29,10 @@ require('script-loader!markdownlint');
|
|||
}
|
||||
|
||||
return {
|
||||
messageHTML: `${ruleNames.slice(0, 1)}: ${ruleDescription}`,
|
||||
messageHTML: `${ruleNames.join('/')}: ${ruleDescription} <small>markdownlint(${ruleNames[0]})</small>`,
|
||||
severity: 'error',
|
||||
from: CodeMirror.Pos(lineNumber, start),
|
||||
to: CodeMirror.Pos(lineNumber, end),
|
||||
__ruleNames: ruleNames,
|
||||
__ruleDescription: ruleDescription,
|
||||
__error: error
|
||||
}
|
||||
})
|
||||
|
@ -47,11 +45,13 @@ export const linterOptions = {
|
|||
fixedTooltip: true,
|
||||
contextmenu: annotations => {
|
||||
const singleFixMenus = annotations
|
||||
.filter(ann => ann.__error.fixInfo)
|
||||
.map(annotation => {
|
||||
const error = annotation.__error
|
||||
const ruleNameAlias = error.ruleNames.join('/')
|
||||
|
||||
if (annotation.__error.fixInfo) {
|
||||
return {
|
||||
content: `Fix ${error.ruleDescription}`,
|
||||
content: `Click to fix this violoation of ${ruleNameAlias}`,
|
||||
onClick () {
|
||||
const doc = window.editor.doc
|
||||
const fixInfo = normalizeFixInfo(error.fixInfo, error.lineNumber)
|
||||
|
@ -82,6 +82,14 @@ export const linterOptions = {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
content: `Click for more information about ${ruleNameAlias}`,
|
||||
onClick () {
|
||||
window.open(error.ruleInformation, '_blank')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return singleFixMenus
|
||||
|
|
Loading…
Reference in New Issue