From 3cb10177f7c77fd22fe574bb5df7f464b1e0ff9f Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 23 Jul 2020 11:08:37 +0700 Subject: [PATCH] hightlighting todos --- src/styles/global.scss | 20 ++++++++++++++++++++ src/utils/dom.ts | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/styles/global.scss b/src/styles/global.scss index 4b112c1a..98ac2bfa 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -49,9 +49,11 @@ body { &:global(.double) { height: $spc * 2; } + &:global(.quadro) { height: $spc * 4; } + &:global(.sixty) { height: $spc * 6; } @@ -83,6 +85,24 @@ body { color: #555555; } +:global { + .todo, .done { + color: #333333; + border-radius: 3px; + padding: 0 2px; + font: $font_14_semibold; + text-transform: uppercase; + } + + .todo { + background-color: $red; + } + + .done { + background-color: $green; + } +} + :global(h2) { font: $font_24_bold; } diff --git a/src/utils/dom.ts b/src/utils/dom.ts index 428b9d79..b8fb3b32 100644 --- a/src/utils/dom.ts +++ b/src/utils/dom.ts @@ -94,6 +94,8 @@ export const formatText = (text: string): string => ) .replace(/:\/\//gim, ':|--|') .replace(/(\/\/[^\n]+)/gim, '$1') + .replace(/\/\/\s*(todo|туду):?\s*([^\n]+)/gim, '// $1 $2') + .replace(/\/\/\s*(done|сделано|сделал|готово|fixed|пофикшено|фиксед):?\s*([^\n]+)/gim, '// $1 $2') .replace(/(\*\*[\s\S]*?\*\*)/gim, '$1') .replace(/(\_\_[\s\S]*?\_\_)/gim, '$1') .replace(/(\!\![\s\S]*?(\!\!|\n|$))/gim, '$1')