diff --git a/web/src/glossary.tsx b/web/src/glossary.tsx index 645e7f0..1e43326 100644 --- a/web/src/glossary.tsx +++ b/web/src/glossary.tsx @@ -10,11 +10,12 @@ export type Glossary = Map; export const GlossaryContext = createContext<{g: Glossary, r: RegExp} | null>(null); -// A component which wraps a paragraph and injects glossary terms into it as -// hoverable pop-up links. The text is immediately rendered normally, but after -// the glossary is loaded (which happens once per page, asynchronously), the -// glossary terms are replaced with elements. -export const GlossaryP: React.FC<{content: string}> = ({content}) => { +// A component which wraps arbitrary html in a span, and injects glossary terms +// into it as hoverable pop-up links. The text is immediately rendered normally, +// but after the glossary is loaded (which happens once per page, asynchronously), +// the glossary terms are replaced with elements. + +export const GlossarySpan: React.FC<{content: string}> = ({content}) => { const g = useContext(GlossaryContext); diff --git a/web/src/pages/_app.tsx b/web/src/pages/_app.tsx index 1935ffc..39d7cd4 100644 --- a/web/src/pages/_app.tsx +++ b/web/src/pages/_app.tsx @@ -43,5 +43,3 @@ const tempHackFetch = (_url: string) => { }, 1000); }); } - - diff --git a/web/src/pages/index.tsx b/web/src/pages/index.tsx index 27fdcf4..d1a84a5 100644 --- a/web/src/pages/index.tsx +++ b/web/src/pages/index.tsx @@ -10,7 +10,7 @@ import Image from 'next/image'; import Header from "../header"; import { SearchBox, Followup } from "../searchbox"; import logo from "../logo.svg" -import { GlossaryP } from "../glossary"; +import { GlossarySpan } from "../glossary"; type Citation = { title: string; @@ -203,7 +203,7 @@ const ShowAssistantEntry: React.FC<{entry: AssistantEntry}> = ({entry}) => { response.split("\n").map(paragraph => (

{ paragraph.split(in_text_citation_regex).map((text, i) => { if (i % 2 === 0) { - return ; + return ; } i = parseInt(text) - 1; if (!citations.has(i)) return `[${text}]`;