Unverified Commit 4b860777 authored by boojack's avatar boojack Committed by GitHub

fix: tag generate in code block (#925)

parent e29924c8
......@@ -99,11 +99,14 @@ export const getMatchedNodes = (markdownStr: string): MatchedNode[] => {
if (parser.name === "br") {
return walkthough(retainContent, blockParsers, inlineParsers);
} else {
if (retainContent.startsWith("\n")) {
if (parser.name !== "code block") {
walkthough(matchedStr, [], inlineParsers);
}
if (retainContent.startsWith("\n")) {
return walkthough(retainContent.slice(1), blockParsers, inlineParsers);
}
}
return "";
}
let matchedInlineParser = undefined;
......
import copy from "copy-to-clipboard";
import hljs from "highlight.js";
import { useTranslation } from "react-i18next";
import { matcher } from "../matcher";
import toastHelper from "../../../components/Toast";
export const CODE_BLOCK_REG = /^```(\S*?)\s([\s\S]*?)```/;
const renderer = (rawStr: string) => {
const { t } = useTranslation();
const matchResult = matcher(rawStr, CODE_BLOCK_REG);
if (!matchResult) {
return <>{rawStr}</>;
......@@ -27,7 +25,7 @@ const renderer = (rawStr: string) => {
const handleCopyButtonClick = () => {
copy(matchResult[2]);
toastHelper.success(t("message.succeed-copy-code"));
toastHelper.success("Copy succeed");
};
return (
......
......@@ -6,7 +6,7 @@
}
> .page-container {
@apply relative w-full min-h-full mx-auto flex flex-row justify-start sm:justify-center items-start;
@apply relative w-full h-auto mx-auto flex flex-row justify-start sm:justify-center items-start;
> .sidebar-wrapper {
@apply flex-shrink-0 ml-calc;
......
.sidebar-wrapper {
@apply fixed sm:sticky top-0 z-30 sm:z-0 -translate-x-64 sm:translate-x-0 sm:flex flex-col justify-start items-start w-64 h-full py-4 pl-2 bg-white dark:bg-zinc-800 sm:bg-transparent overflow-x-hidden overflow-y-auto transition-transform duration-300 overscroll-contain hide-scrollbar;
@apply fixed sm:sticky top-0 z-30 sm:z-0 -translate-x-64 sm:translate-x-0 sm:flex flex-col justify-start items-start w-64 h-auto max-h-screen py-4 pl-2 bg-white dark:bg-zinc-800 sm:bg-transparent overflow-x-hidden overflow-y-auto transition-transform duration-300 overscroll-contain hide-scrollbar;
&.show {
@apply translate-x-0 shadow-2xl sm:shadow-none;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment