diff --git a/src/global.d.ts b/src/global.d.ts index 4ca5582d482..a0de9b3eb2f 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -10,6 +10,7 @@ declare global { // Nextcloud Globals t: typeof import('@nextcloud/l10n').t n: typeof import('@nextcloud/l10n').n + // eslint-disable-next-line @typescript-eslint/no-explicit-any OCA: Record OCP: Nextcloud.v29.OCP } diff --git a/src/markdownit/details.ts b/src/markdownit/details.ts index 15f316c1004..ac0493b1c53 100644 --- a/src/markdownit/details.ts +++ b/src/markdownit/details.ts @@ -13,10 +13,10 @@ const SUMMARY_REGEX = /(?<=^).*(?=<\/summary>\s*$)/ /** * - * @param state - * @param startLine - * @param endLine - * @param silent + * @param state - MarkdownIt state + * @param startLine - start line number + * @param endLine - end line number + * @param silent - validation mode */ function parseDetails(state: StateBlock, startLine: number, endLine: number, silent: boolean) { // let autoClosedBlock = false @@ -120,7 +120,7 @@ function parseDetails(state: StateBlock, startLine: number, endLine: number, sil } /** - * @param {object} md Markdown object + * @param {object} md - Markdown object */ export default function details(md: MarkdownIt) { md.block.ruler.before('fence', 'details', parseDetails, { diff --git a/src/markdownit/taskLists.ts b/src/markdownit/taskLists.ts index 6cb9e8d58ff..ee173efea52 100644 --- a/src/markdownit/taskLists.ts +++ b/src/markdownit/taskLists.ts @@ -21,139 +21,197 @@ interface TaskListsOptions { const checkboxRegex = /^ *\[([\sx])] /i +/** + * + * @param md - + * @param options - taskLists plugin options + */ export default function taskLists( - md: MarkdownIt, - options: TaskListsOptions = { enabled: false, label: false, lineNumber: false } + md: MarkdownIt, + options: TaskListsOptions = { enabled: false, label: false, lineNumber: false }, ): void { - md.core.ruler.after('inline', 'task-lists', (state) => processToken(state, options)) - md.renderer.rules.taskListItemCheckbox = (tokens) => { - const token = tokens[0] - const checkedAttribute = token.attrGet('checked') ? 'checked="" ' : '' - const disabledAttribute = token.attrGet('disabled') ? 'disabled="" ' : '' - const line = token.attrGet('line') - const idAttribute = `id="${token.attrGet('id')}" ` - const dataLineAttribute = line && options.lineNumber ? `data-line="${line}" ` : '' - - return `` - } - - md.renderer.rules.taskListItemLabel_close = () => { - return '' - } - - md.renderer.rules.taskListItemLabel_open = (tokens: Token[]) => { - const token = tokens[0] - const id = token.attrGet('id') - return `' + } + + md.renderer.rules.taskListItemLabel_open = (tokens: Token[]) => { + const token = tokens[0] + const id = token.attrGet('id') + return `