From c1c72a539f06cb63e30d64a49c3ed2a967eac14b Mon Sep 17 00:00:00 2001 From: SeeLey Wang <37832104+zizdlp@users.noreply.github.com> Date: Sun, 18 Aug 2024 20:52:40 +0800 Subject: [PATCH] fix list style (#13) --- .../src/components/parsers/HtmlParser.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/zbook_frontend/src/components/parsers/HtmlParser.tsx b/zbook_frontend/src/components/parsers/HtmlParser.tsx index bbda0b0..48113e4 100644 --- a/zbook_frontend/src/components/parsers/HtmlParser.tsx +++ b/zbook_frontend/src/components/parsers/HtmlParser.tsx @@ -13,7 +13,7 @@ import { FaInfoCircle } from "react-icons/fa"; import { MdError, MdTipsAndUpdates } from "react-icons/md"; import { TiWarning } from "react-icons/ti"; import { ThemeColor } from "../TableOfContent"; - +import { headers } from "next/headers"; interface Attribute { name: string; value: string; @@ -140,7 +140,7 @@ const parseHTMLString = ( ); } else if (tagName === "LI") { return ( -
  • +
  • {Array.from(node.childNodes).map(processNode)}
  • ); @@ -347,7 +347,10 @@ interface HtmlParserProps { repo_name: string; theme_color: ThemeColor; } - +function isSafari(userAgent: string): boolean { + const isSafari = /^((?!chrome|android|crios|fxios).)*safari/i.test(userAgent); + return isSafari; +} const HtmlParser: React.FC = ({ htmlString, prefixPath, @@ -362,11 +365,12 @@ const HtmlParser: React.FC = ({ repo_name, theme_color ); + const agent = headers().get("User-Agent") ?? ""; return (
    {parsedHTML}