diff --git a/content/4_Plat/Plat_Fracture.md b/content/4_Plat/Plat_Fracture.md index 2c28ccb..15a7000 100644 --- a/content/4_Plat/Plat_Fracture.md +++ b/content/4_Plat/Plat_Fracture.md @@ -42,7 +42,7 @@ For this problem, the objects are spanning trees and the "root" is the minimum s This is equivalent to the solution given in the video. The runtime is $O(NMK\alpha(N))$ for storing the information about each spanning tree and $O(NK\log (NK))$ for the priority queue. ```cpp -#include +#include using namespace std; typedef bitset<1225> B; typedef vector vi; diff --git a/src/components/Markdown.js b/src/components/Markdown.js index 85cfcc2..81dae2a 100644 --- a/src/components/Markdown.js +++ b/src/components/Markdown.js @@ -3,10 +3,30 @@ import rehypeReact from "rehype-react" import "katex/dist/katex.min.css"; import "../components/prism-theme.css"; +import "./spoiler.css" + +const SpoilerComponent = ({ children }) => { + const [show, setShow] = React.useState(false); + + return ( +
{if (e.target.classList.contains("spoiler-label")) setShow(!show) }}> + {children} +
+ ); +}; const renderAst = new rehypeReact({ createElement: React.createElement, components: { + details: SpoilerComponent, + summary: ({ children }) => ( +

+ + + {children} +

+ ) }, }).Compiler; diff --git a/src/components/spoiler.css b/src/components/spoiler.css new file mode 100644 index 0000000..cdeb29c --- /dev/null +++ b/src/components/spoiler.css @@ -0,0 +1,12 @@ +.spoiler--hide > *:not(.spoiler-label) { + display: none; +} +.spoiler--hide .spoiler-label__open { + display: none; +} +.spoiler--show .spoiler-label__closed { + display: none; +} +.spoiler-label { + margin-bottom: 0 !important; +} \ No newline at end of file