Skip to content

Commit f77e962

Browse files
committed
use katex.renderToString for all formulas
1 parent eed0b3f commit f77e962

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

src/metricLibrary.tsx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,16 @@ export const METRIC_RICH_CONTENT: Record<string, MetricDefinitionRich> = {
2828
<div style={{ background: '#f8fafc', padding: '1rem', borderRadius: '8px', border: '1px solid #e2e8f0', textAlign: 'center' }}>
2929
<h4>Confusion Matrix Formula</h4>
3030
<div style={{ display: 'flex', justifyContent: 'center', gap: '3em' }}>
31-
<BlockMath math={String.raw`DSC = \frac{2*TP}{2*TP + FP + FN}`} />
32-
31+
<div dangerouslySetInnerHTML={{
32+
__html: katex.renderToString(
33+
String.raw`DSC = \frac{2*TP}{2*TP + FP + FN}`,
34+
{
35+
throwOnError: false,
36+
strict: "ignore",
37+
displayMode: true,
38+
}
39+
)
40+
}} />
3341
<div style={{ display: 'inline-flex', flexDirection: 'column', alignItems: 'center' }}>
3442
{/* Numerator */}
3543
<div
@@ -97,13 +105,29 @@ export const METRIC_RICH_CONTENT: Record<string, MetricDefinitionRich> = {
97105
The IoU <InlineMath math="IoU" /> is the standard metric for object detection and semantic segmentation challenges. It calculates the ratio of the intersection area to the union area of the two masks.
98106
</p>
99107

100-
<BlockMath math={String.raw`IoU = \frac{\text{Area of Overlap}}{\text{Area of Union}} = \frac{|X \cap Y|}{|X \cup Y|}`} />
101-
108+
<div dangerouslySetInnerHTML={{
109+
__html: katex.renderToString(
110+
String.raw`IoU = \frac{\text{Area of Overlap}}{\text{Area of Union}} = \frac{|X \cap Y|}{|X \cup Y|}`,
111+
{
112+
throwOnError: false,
113+
strict: "ignore",
114+
displayMode: true,
115+
}
116+
)
117+
}} />
102118
<div style={{ background: '#f8fafc', padding: '1rem', borderRadius: '8px', border: '1px solid #e2e8f0', textAlign: 'center' }}>
103119
<h4>Confusion Matrix Formula</h4>
104120
<div style={{ display: 'flex', justifyContent: 'center', gap: '3em' }}>
105-
<BlockMath math={String.raw`IoU = \frac{TP}{TP + FP + FN}`} />
106-
121+
<div dangerouslySetInnerHTML={{
122+
__html: katex.renderToString(
123+
String.raw`IoU = \frac{TP}{TP + FP + FN}`,
124+
{
125+
throwOnError: false,
126+
strict: "ignore",
127+
displayMode: true,
128+
}
129+
)
130+
}} />
107131
<div style={{ display: 'inline-flex', flexDirection: 'column', alignItems: 'center' }}>
108132
{/* Numerator */}
109133
<div

0 commit comments

Comments
 (0)