mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: bold and emphasis regex (#323)
* fix: bold and emphasis regex * chore: udpate
This commit is contained in:
@@ -123,6 +123,14 @@ console.log("hello world!")
|
|||||||
markdown: `Important: ***Minecraft/123***`,
|
markdown: `Important: ***Minecraft/123***`,
|
||||||
want: `<p>Important: <strong><em>Minecraft/123</em></strong></p>`,
|
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)***`,
|
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>`,
|
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 Emphasis from "./Emphasis";
|
||||||
import Link from "./Link";
|
import Link from "./Link";
|
||||||
|
|
||||||
export const BOLD_REG = /\*\*([\S ]+)\*\*/;
|
export const BOLD_REG = /\*\*([\S *]+)\*\*/;
|
||||||
|
|
||||||
const renderer = (rawStr: string): string => {
|
const renderer = (rawStr: string): string => {
|
||||||
const matchResult = rawStr.match(BOLD_REG);
|
const matchResult = rawStr.match(BOLD_REG);
|
||||||
|
@@ -2,7 +2,7 @@ import { marked } from "..";
|
|||||||
import Bold from "./Bold";
|
import Bold from "./Bold";
|
||||||
import Link from "./Link";
|
import Link from "./Link";
|
||||||
|
|
||||||
export const EMPHASIS_REG = /\*([\S ]+)\*/;
|
export const EMPHASIS_REG = /\*([\S ]+?)\*/;
|
||||||
|
|
||||||
const renderer = (rawStr: string): string => {
|
const renderer = (rawStr: string): string => {
|
||||||
const matchResult = rawStr.match(EMPHASIS_REG);
|
const matchResult = rawStr.match(EMPHASIS_REG);
|
||||||
|
Reference in New Issue
Block a user