Skip to content

Commit d20af3e

Browse files
committed
Update equation blocks
1 parent c54d7a0 commit d20af3e

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

dev/serve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import Dev from "./serve.vue";
33

44
import VueKatex from "vue-katex";
55

6-
Vue.config.productionTip = false;
7-
86
Vue.use(VueKatex);
97

8+
Vue.config.productionTip = false;
9+
1010
new Vue({
1111
render: (h) => h(Dev),
1212
}).$mount("#app");

dev/serve.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div id="app">
3-
<NotionRenderer :blockMap="blockMap" fullPage prism todo />
3+
<NotionRenderer :blockMap="blockMap" fullPage prism katex todo />
44
</div>
55
</template>
66

src/blocks/code.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,25 @@
1212
<script>
1313
import Prism from "prismjs";
1414
import PrismComponent from "vue-prism-component";
15-
import Blockable, { blockComputed } from "@/lib/blockable";
15+
import Blockable, { blockComputed, blockProps } from "@/lib/blockable";
1616
1717
export default {
1818
extends: Blockable,
1919
name: "NotionCode",
2020
components: { PrismComponent },
21+
props: { ...blockProps, overrideLang: String, overrideLangClass: String },
2122
data() {
2223
return { Prism };
2324
},
2425
computed: {
2526
...blockComputed,
2627
lang() {
27-
return this.properties?.language?.[0]?.[0]?.toLowerCase();
28+
return (
29+
this.overrideLang || this.properties?.language?.[0]?.[0]?.toLowerCase()
30+
);
2831
},
2932
langClass() {
30-
return `language-${this.lang}`;
33+
return this.overrideLangClass || `language-${this.lang}`;
3134
},
3235
supported() {
3336
return this.Prism.languages[this.lang];

src/blocks/decorator.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
:expression="decoratorValue"
6161
/>
6262
<code v-else-if="decoratorKey === 'e'" class="notion-inline-code">
63-
<NotionDecorator :content="nextContent" v-bind="pass" />
63+
{{ decoratorValue }}
6464
</code>
6565
<NotionDecorator v-else :content="nextContent" v-bind="pass" />
6666
</template>

src/blocks/equation.vue

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
<template>
22
<div v-if="katex">
3-
<KatexElement :expression="equation" />
3+
<component :is="'katex-element'" :expression="equation" />
44
</div>
5-
<pre v-else-if="prism && supported" :class="['notion-code', langClass]">
6-
<PrismComponent :language="lang">{{ equation }}</PrismComponent>
7-
</pre>
8-
<pre v-else :class="['notion-code', langClass]">
9-
<code :class="langClass">{{ equation }}</code>
10-
</pre>
5+
<NotionCode
6+
v-else
7+
v-bind="pass"
8+
overrideLang="latex"
9+
overrideLangClass="language-latex"
10+
/>
1111
</template>
1212

1313
<script>
14-
import KatexElement from "vue-katex";
1514
import Blockable, { blockComputed } from "@/lib/blockable";
15+
import NotionCode from "@/blocks/code";
1616
1717
export default {
1818
extends: Blockable,
19-
name: "NotionCode",
20-
components: { KatexElement },
21-
data() {
22-
return { Prism, lang: "latex", langClass: "language-latex" };
23-
},
19+
name: "NotionEquation",
20+
components: { NotionCode },
2421
computed: {
2522
...blockComputed,
2623
equation() {

0 commit comments

Comments
 (0)