From 0d7d95d2ac569149e637271f7bae61996b327a40 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Wed, 8 Dec 2021 23:56:19 -0500 Subject: [PATCH] fix: markdown checkbox rendering with links --- client/components/editor/editor-markdown.vue | 4 +-- client/themes/default/scss/app.scss | 30 +++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/client/components/editor/editor-markdown.vue b/client/components/editor/editor-markdown.vue index 252eb4a0..e334f07b 100644 --- a/client/components/editor/editor-markdown.vue +++ b/client/components/editor/editor-markdown.vue @@ -290,7 +290,7 @@ const md = new MarkdownIt({ }) .use(underline) .use(mdEmoji) - .use(mdTaskLists, {label: true, labelAfter: true}) + .use(mdTaskLists, {label: false, labelAfter: false}) .use(mdExpandTabs) .use(mdAbbr) .use(mdSup) @@ -627,7 +627,7 @@ export default { hint: async (cm, options) => { const cur = cm.getCursor() const curLine = cm.getLine(cur.line).substring(0, cur.ch) - const queryString = curLine.substring(curLine.lastIndexOf('[')+1,curLine.length-2) + const queryString = curLine.substring(curLine.lastIndexOf('[') + 1, curLine.length - 2) const token = cm.getTokenAt(cur) try { const respRaw = await this.$apollo.query({ diff --git a/client/themes/default/scss/app.scss b/client/themes/default/scss/app.scss index bf23bde5..d03c88b5 100644 --- a/client/themes/default/scss/app.scss +++ b/client/themes/default/scss/app.scss @@ -77,7 +77,7 @@ & + h2, & + h3, & + h4, & + h5, & + h6 { margin-top: 8px; } - + & + hr.footnotes-sep { display: none; } @@ -508,7 +508,7 @@ } } - ul:not(.tabset-tabs) { + ul:not(.tabset-tabs):not(.contains-task-list) { list-style: none; > li::before { position: absolute; @@ -596,21 +596,25 @@ // TASK LISTS // --------------------------------- + .contains-task-list { + padding-left: 0; + } + .task-list-item { position: relative; list-style-type: none; &-checkbox[disabled] { - display: none; - - & + label { - padding-left: 1.5rem; - } + width: 1.1rem; + height: 1.1rem; + top: 2px; + position: relative; + margin-right: 2px; - & + label::before { + &::after { position: absolute; left: 0; - top: 2px; + top: 0; content: ' '; display: block; width: 1.1rem; @@ -629,7 +633,7 @@ } } - &[checked] + label::before { + &[checked]::after { content: '✓'; } } @@ -817,15 +821,15 @@ outline: none; background-color: mc('grey', '100'); } - + > h1, h2, h3, h4, h5, h6 { width: 95%; display: inline-block; - + &:first-child { margin-top: 0; } - + &:only-child::after { display: none; }