diff --git a/src/common/assets/highlight.module.css b/src/common/assets/highlight.module.css index 9a2acf4..d6832f6 100644 --- a/src/common/assets/highlight.module.css +++ b/src/common/assets/highlight.module.css @@ -80,4 +80,8 @@ border: none; border-top: 1px solid var(--hrColor, #555); margin: 0.5em 0; + + &.inline { + margin-top: -0.5em; + } } \ No newline at end of file diff --git a/src/common/highlight.ts b/src/common/highlight.ts index 0a3fa11..7156a4c 100644 --- a/src/common/highlight.ts +++ b/src/common/highlight.ts @@ -41,7 +41,7 @@ export const parseTable = (table: string): string => { export const highlight = (message: string, keepMarkup = true): string => { let resultHTML = ''; - const tokenRegex = /(\*\*?|"|```|`|(?:^|\n)#{1,3} |(?:^|\n)> |\n)/g; + const tokenRegex = /(\*{1,3}|"|```|`|(?:^|\n)#{1,3} |(?:^|\n)> |\n)|---/g; const headerRegex = /#{1,3} $/; const blockquoteRegex = /> $/; const stack: string[] = []; @@ -116,7 +116,9 @@ export const highlight = (message: string, keepMarkup = true): string => { continue; } - if (isClose) { + if (token === '***' || token === '---') { + resultHTML += `${keepToken ? token : ''}