Skip to content

Commit c309d61

Browse files
committed
resolve merge conflict
1 parent a66fda4 commit c309d61

File tree

7 files changed

+381
-4
lines changed

7 files changed

+381
-4
lines changed

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-notion-custom/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"@matejmazur/react-katex": "^3.1.3",
1314
"@types/he": "^1.2.3",
1415
"@types/katex": "^0.16.7",
1516
"he": "^1.2.0",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @link react-katex https://github.com/MatejBransky/react-katex?tab=readme-ov-file
3+
*/
4+
import "katex/dist/katex.min.css";
5+
import TeX from "@matejmazur/react-katex";
6+
7+
import { EquationArgs } from "../types";
8+
9+
const Equation = ({ equation: { expression } }: EquationArgs) => {
10+
return (
11+
<TeX className="notion-block notion-equation notion-equation-block">
12+
{expression}
13+
</TeX>
14+
);
15+
};
16+
17+
export default Equation;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import Headings from "./headings";
22
import Paragraph from "./paragraph";
33
import Toggle from "./toggle";
4+
import Equation from "./equation";
45

5-
export { Headings, Paragraph, Toggle };
6+
export { Headings, Paragraph, Toggle, Equation };
67

78
export default {
89
heading_1: Headings,
910
heading_2: Headings,
1011
heading_3: Headings,
1112
paragraph: Paragraph,
1213
toggle: Toggle,
14+
equation: Equation,
1315
};

packages/react-notion-custom/src/lib/index.css

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@
107107
border-top-width: 8px;
108108
}
109109

110+
.notion-toggle-title {
111+
display: block;
112+
width: 100%;
113+
}
114+
110115
.notion-h-content {
111116
position: relative;
112117

@@ -558,7 +563,30 @@
558563
.notion-paragraph-content {
559564
padding: 3px 2px;
560565
}
561-
.notion-toggle-title {
562-
display: block;
563-
width: 100%;
566+
567+
.notion-equation {
568+
position: relative;
569+
display: inline-flex;
570+
color: inherit;
571+
fill: inherit;
572+
user-select: none;
573+
border-radius: 3px;
574+
transition: background 20ms ease-in 0s;
575+
}
576+
.notion-equation-block {
577+
display: flex;
578+
flex-direction: column;
579+
justify-items: center;
580+
align-items: center;
581+
overflow: auto;
582+
padding: 16px 8px;
583+
margin: 2px 0;
584+
cursor: pointer;
585+
}
586+
.notion-equation:hover {
587+
background: var(--bg-color-0);
588+
}
589+
.notion-equation:active,
590+
.notion-equation:focus {
591+
background: var(--select-color-2);
564592
}

0 commit comments

Comments
 (0)