File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ export default {
2020 },
2121 async created () {
2222 // react-notion tester: 2e22de6b770e4166be301490f6ffd420
23- this .blockMap = await getPageBlocks (" 2e22de6b770e4166be301490f6ffd420" );
23+ // Equation terser: add9966dd1ae4d839ccec39150f90c5d
24+ this .blockMap = await getPageBlocks (" add9966dd1ae4d839ccec39150f90c5d" );
2425 },
2526};
2627 </script >
Original file line number Diff line number Diff line change 2929 "dependencies" : {
3030 "cross-fetch" : " ^3.0.6" ,
3131 "defu" : " ^5.0.0" ,
32+ "katex" : " ^0.13.16" ,
3233 "vue-fragment" : " ^1.5.1" ,
3334 "vue-prism-component" : " ^1.2.0"
3435 },
Original file line number Diff line number Diff line change 44 class =" notion-link"
55 target =" _blank"
66 :href =" decoratorValue"
7- >{{ pageLinkTitle }}</ a
8- >
7+ >{{ pageLinkTitle }}
8+ </ a >
99 <span v-else-if =" decorators.length === 0" >{{ text }}</span >
1010 <span v-else-if =" decoratorKey === 'h'" :class =" 'notion-' + decoratorValue"
1111 ><NotionDecorator :content =" nextContent" v-bind =" pass" />
3030 >
3131 <NotionDecorator :content =" nextContent" v-bind =" pass" />
3232 </a >
33+ <span
34+ v-else-if =" decoratorKey === 'e'"
35+ v-html =" inlineEquation"
36+ />
3337 <NotionDecorator v-else :content =" nextContent" v-bind =" pass" />
3438</template >
3539
3640<script >
3741import Blockable , { blockProps } from " @/lib/blockable" ;
42+ import katex from ' katex' ;
43+ import ' katex/dist/katex.css' ;
3844
3945export default {
4046 extends: Blockable,
@@ -66,6 +72,11 @@ export default {
6672 isPageLink () {
6773 return this .text === " ‣" ;
6874 },
75+ inlineEquation () {
76+ return katex .renderToString (this .decoratorValue , {
77+ throwOnError: false ,
78+ });
79+ },
6980 pageLinkTitle () {
7081 return (
7182 this .blockMap ? .[this .decoratorValue ]? .value ? .properties
@@ -74,4 +85,4 @@ export default {
7485 },
7586 },
7687};
77- < / script>
88+ < / script>
You can’t perform that action at this time.
0 commit comments