lucpotage / vue-katex Goto Github PK
View Code? Open in Web Editor NEWVue plugin for KaTeX
License: MIT License
Vue plugin for KaTeX
License: MIT License
Is there any way to check if rendering is complete so I can hide / show components when necessary? If not are there any workarounds that you can think of?
Hello Community,
I am trying to use v-katex:auto to auto render a value from an input. I bind the value to output to my input but it's not working. Does anyone have an idea?
It seems that some important feature of katex does not be included in vue-katex such as \tag and \begin{matrix}. If it is not true, maybe more examples can be included to help using it. Thanks.
Error trying to install VueKatex plugin due to possible changes in Vue3. I am facing this error only when I try to install the Vue-Katex plugin:
import 'katex/dist/katex.min.css'
import VueKatex from 'vue-katex'
const app = createApp(App)
app.use(VueKatex, {
globalOptions: {}
})
This is possibly due to the migration to Vue3 according to this [reddit post]:(https://www.reddit.com/r/vuejs/comments/j99qgn/help_vue_js_3_cannot_read_property_prototype_of/)
// Before
Vue.prototype.$http = () => {}
// After
const app = Vue.createApp({})
app.config.globalProperties.$http = () => {}
Ps. This is my first issue so please guide me on how to author these for future reference. Apologies if I break any unspoken rules ππ½
Heys guys,
maybe someone can help me out here. I want to use $-signs as delimiters and i tried this code-snippet:
v-katex:auto="{delimiters: [{ left: '$', right: '$', display: false }],}"
For some reason the delimiters are are still standard. Any ideas?
I can't see katex in chrome browser (firefox is ok)
This is in firefox browser
Please help me !!!!
@lucpotage
@shadskii
When using Nuxt, it seems nothing actually appears on the page.
Here's a brief example on what I'm doing inside a component below. None of the following ways produce any rendered text. Is this an issue relating to Nuxt?
<template>
<div class="page-wrapper">
<div v-katex:auto> \(\frac{a_i}{1+x}\) </div>
<katex-element expression="'\\frac{a_i}{1+x}'"/>
<KatexElement> \(\frac{a_i}{1+x}\) </KatexElement>
</div>
</template>
<script>
import VueKatex from 'vue-katex'
import 'katex/dist/katex.min.css'
components: {
'katex-element': VueKatex
},
</script>
v-katex ζθ―δΊδΈδΈοΌζζ¬ζ―ε―δ»₯ηοΌδ½ζ―ε¦ζιι’ζζ ηΎζ―δΈζ―ζηοΌθΏδΈͺζδΉθ§£ε³οΌ
I imported the mhchem.min.js with script tag;
but it did'nt work;
The latest version of this package has not been release to npm. The current version on npm is trailing by two minor versions (0.2.0 on npm vs 0.2.2 on github).
@lucpotage I believe that this project is important and I would like to continue to contribute to it. I can provide a lot more help to you if I am able to take a more hands on role in this project. I would like to discuss with you what this would entail. Please email me at [email protected].
I look forward to working with you. π
Jake
when building a vite app that uses vue-katex, the build breaks due to const merge = require('deepmerge')
i've been able to fix this manually by copying the katex-directive.js
code in my plugin.js
file, and changing the line above to import merge from 'deepmerge'
Does it works?
Hi ,how to use katex in vueJS ,is there some demo,like the angular-katex, which allow lable
<!-- Tag element -->
<katex>x^2</katex>
<!-- Attribute -->
<div katex>x^2</div>
<!-- Attribute value -->
<div katex="x^2"></div>
<!-- expr attribute value -->
<katex expr="x^2"></katex>
<!-- Bind to scope
$scope.tex = {pow: 'x^2'}
-->
<katex bind="tex.pow"></katex>
<!-- Set display mode -->
<katex expr="x^2" display-mode></katex>
In the readme of this project, neither the installation or usage instructions mention that you need to include the CSS file found here https://github.com/Khan/KaTeX#usage in order for the SVGs to render correctly.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-alpha2/katex.min.css" integrity="sha384-exe4Ak6B0EoJI0ogGxjJ8rn+RN3ftPnEQrGwX59KTCl5ybGzvHGKjhPKk/KC3abb" crossorigin="anonymous">
It would be good for first time users if it mentioned it or included adding the CSS as a step. Thanks!
Hi @lucpotage and @shadskii
I have a problem ! I want to render katex in textarea but i can't do it.
This is my textarea
<textarea class="w-100" v-katex:auto="options"> {{ form.selectedKatex }}</textarea>
This is my options
data() {
return {
options: [
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: true},
{left: "\\(", right: "\\)", display: true},
{left: "\\[", right: "\\]", display: true}
]
}
},
Please help me !!!
Hi! I tried to make Laravel Nova field from vue-katex, but don't works(
https://nova.laravel.com/docs/3.0/customization/fields.html
Field file:
<template>
<panel-item :field="field">
<template slot="value">
<div v-katex="'\\frac{a_i}{1+x}'"></div>
<div v-katex:display="'\\frac{a_i}{1+x}'"></div>
<div v-katex="{ expression: '\\frac{a_i}{1+x}', options: { throwOnError: false }}"></div>
<div v-katex:auto>
\(\frac{a_i}{1+x}\)
</div>
<div v-katex:auto="{ options }">
\(\frac{a_i}{1+x}\)
</div>
<katex-element expression="'\\frac{a_i}{1+x}'"/>
</template>
</panel-item>
</template>
<script>
import Vue from 'vue';
import VueKatex from 'vue-katex';
Vue.use(VueKatex);
export default {
components: {
VueKatex
},
props: ['resource', 'resourceName', 'resourceId', 'field'],
}
</script>
<style>
@import "../../../node_modules/katex/dist/katex.min.css";
</style>
But nothing rendered:
No errors in browser console
Hi,
is there any plan to support the auto-render extension?
I'm looking for a way to render all the math in some text without having to specify directives or KatexElement components for each expression since the text is retrieved dynamically and these wouldn't work...
Hello Community,
I am using vue-cli as my develop tool. I was trying to use mhchem extension to enter the chemical formulas for my webapp, like the README said: "This extension isn't part of core KaTeX, so the script should be separately included. Place it after the line that calls katex.js." I was trying to include it in index.html but failed ( I think the problem is because index.html is alive before the components in vue). I am willing to know how/where to include this extension in my webapp? Thanks for replying
My math equations are coming from a data source that could potentially contain html elements like <br>
, <b>
, <u>
or <i>
. Using the expression
prop from vue-katex, I can't have it both ways. HTML rendered, or Math. Help me out here.
ERROR in ./node_modules/vue-katex/dist/vue-katex.es.min.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.assign'
ERROR in ./node_modules/vue-katex/dist/vue-katex.es.min.js
Module not found: Error: Can't resolve 'core-js/modules/es6.number.constructor'
ERROR in ./node_modules/vue-katex/dist/vue-katex.es.min.js
Module not found: Error: Can't resolve 'core-js/modules/es6.function.name'
I just tried to install this in a new vue project to test it out and am getting the above error.
Hi! Great project, enjoy using it so far :)
I have a span-element with the v-katex:auto
attribute, to which I pass user input. How can I call the renderMathInElement
function from my component?
Master is currently at 0.2.2 but the latest version on npm is 0.2.1. One of the projects I work on is currently using 0.2.1 but is experiencing a bug with it. I fixed that bug in my last PR and bumped the version to 0.2.2.
Thanks,
Jake
Hello, when I build, the KaTeX does not render properly. It looks like it is halfway through its processing or something because it duplicates the expression but with only the numbers/letters:
It works absolutely fine running dev:
I would love your help with this.
Thanks,
Joshid
p.s. i have pasted the two versions of the generated html below
Dev:
<div data-v-73e562e7="" class="_question"><span><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mrow><msup><mi>l</mi><mn>2</mn></msup><msup><mi>a</mi><mn>3</mn></msup></mrow><mrow><msup><mi>l</mi><mn>5</mn></msup><mi>a</mi></mrow></mfrac><mo>=</mo></mrow><annotation encoding="application/x-tex">\frac{l^{2}a^{3}}{l^{5}a}=</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 1.36292em; vertical-align: -0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 1.01792em;"><span class="" style="top: -2.655em;"><span class="pstrut" style="height: 3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathdefault mtight" style="margin-right: 0.01968em;">l</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.746314em;"><span class="" style="top: -2.786em; margin-right: 0.0714286em;"><span class="pstrut" style="height: 2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">5</span></span></span></span></span></span></span></span></span><span class="mord mathdefault mtight">a</span></span></span></span><span class="" style="top: -3.23em;"><span class="pstrut" style="height: 3em;"></span><span class="frac-line" style="border-bottom-width: 0.04em;"></span></span><span class="" style="top: -3.394em;"><span class="pstrut" style="height: 3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathdefault mtight" style="margin-right: 0.01968em;">l</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.891314em;"><span class="" style="top: -2.931em; margin-right: 0.0714286em;"><span class="pstrut" style="height: 2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mord mtight"><span class="mord mathdefault mtight">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.891314em;"><span class="" style="top: -2.931em; margin-right: 0.0714286em;"><span class="pstrut" style="height: 2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span></span></span></span><span class="vlist-s">β</span></span><span class="vlist-r"><span class="vlist" style="height: 0.345em;"><span class=""></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span></span></span></span></span></div>
Build:
<div data-v-73e562e7="" class="_question"><span><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mrow><msup><mi>l</mi><mn>2</mn></msup><msup><mi>a</mi><mn>3</mn></msup></mrow><mrow><msup><mi>l</mi><mn>5</mn></msup><mi>a</mi></mrow></mfrac><mo>=</mo></mrow><annotation encoding="application/x-tex">\frac{l^{2}a^{3}}{l^{5}a}=</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 1.36292em; vertical-align: -0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 1.01792em;"><span class="" style="top: -2.655em;"><span class="pstrut" style="height: 3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathdefault mtight" style="margin-right: 0.01968em;">l</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.746314em;"><span class="" style="top: -2.786em; margin-right: 0.0714286em;"><span class="pstrut" style="height: 2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">5</span></span></span></span></span></span></span></span></span><span class="mord mathdefault mtight">a</span></span></span></span><span class="" style="top: -3.23em;"><span class="pstrut" style="height: 3em;"></span><span class="frac-line" style="border-bottom-width: 0.04em;"></span></span><span class="" style="top: -3.394em;"><span class="pstrut" style="height: 3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathdefault mtight" style="margin-right: 0.01968em;">l</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.891314em;"><span class="" style="top: -2.931em; margin-right: 0.0714286em;"><span class="pstrut" style="height: 2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mord mtight"><span class="mord mathdefault mtight">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.891314em;"><span class="" style="top: -2.931em; margin-right: 0.0714286em;"><span class="pstrut" style="height: 2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span></span></span></span><span class="vlist-s">β</span></span><span class="vlist-r"><span class="vlist" style="height: 0.345em;"><span class=""></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span></span></span></span></span></div>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.