mirror of
https://github.com/usememos/memos.git
synced 2025-02-21 21:57:47 +01:00
fix: bold and emphasis regex (#323)
* fix: bold and emphasis regex * chore: udpate
This commit is contained in:
parent
7c9c5c316b
commit
0b2a9d8511
@ -123,6 +123,14 @@ console.log("hello world!")
|
||||
markdown: `Important: ***Minecraft/123***`,
|
||||
want: `<p>Important: <strong><em>Minecraft/123</em></strong></p>`,
|
||||
},
|
||||
{
|
||||
markdown: `Important: **Minecraft*123***`,
|
||||
want: `<p>Important: <strong>Minecraft<em>123</em></strong></p>`,
|
||||
},
|
||||
{
|
||||
markdown: `Important: **Minecraft*123*456**`,
|
||||
want: `<p>Important: <strong>Minecraft<em>123</em>456</strong></p>`,
|
||||
},
|
||||
{
|
||||
markdown: `Important: ***[baidu](https://baidu.com)***`,
|
||||
want: `<p>Important: <strong><em><a class='link' target='_blank' rel='noreferrer' href='https://baidu.com'>baidu</a></em></strong></p>`,
|
||||
|
@ -2,7 +2,7 @@ import { marked } from "..";
|
||||
import Emphasis from "./Emphasis";
|
||||
import Link from "./Link";
|
||||
|
||||
export const BOLD_REG = /\*\*([\S ]+)\*\*/;
|
||||
export const BOLD_REG = /\*\*([\S *]+)\*\*/;
|
||||
|
||||
const renderer = (rawStr: string): string => {
|
||||
const matchResult = rawStr.match(BOLD_REG);
|
||||
|
@ -2,7 +2,7 @@ import { marked } from "..";
|
||||
import Bold from "./Bold";
|
||||
import Link from "./Link";
|
||||
|
||||
export const EMPHASIS_REG = /\*([\S ]+)\*/;
|
||||
export const EMPHASIS_REG = /\*([\S ]+?)\*/;
|
||||
|
||||
const renderer = (rawStr: string): string => {
|
||||
const matchResult = rawStr.match(EMPHASIS_REG);
|
||||
|
Loading…
x
Reference in New Issue
Block a user