0.1.1 • Published 2 years ago

vue-mathjax v0.1.1

Weekly downloads
582
License
-
Repository
github
Last release
2 years ago

vue-mathjax

npm npm vue2

A Vue.js Plugin for Mathjax

Before Usage

  • This is a plugin for vue2, if you are looking for vue3, maybe you can check this

  • This plugin is not compatible with MathJax@3, you can make a PR if you know how to do it.

Table of contents

Installation

npm install --save vue-mathjax

Usage

❗️❗️Don't forget to import the Mathjax.js:

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-AMS_HTML"></script>

import VueMathjax from 'vue-mathjax'
Vue.use(VueMathjax)

OR

import {VueMathjax} from 'vue-mathjax'
export default {
  ...
  components: {
    'vue-mathjax': VueMathjax
  },
  ...
<template>
<div>
<textarea v-model="formula" cols="30" rows="10"></textarea>
  <vue-mathjax :formula="formula"></vue-mathjax>
</div>
</template>

<script>
<!-- You can also define globally -->
import { VueMathjax } from 'vue-mathjax'
export default {
  components: {
    'vue-mathjax': VueMathjax
  },
  name: 'HelloWorld',
  data () {
    return {
      formula: '$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$',
      msg: 'Welcome to Your Vue.js App'
    }
  }
}
</script>

Props

formula

type: string mathjax string

safe

type: boolean; default: true sometimes you want render the html in your mathjax, so just set it to false. demo: https://codesandbox.io/s/vue-template-ftd5s

options

type: object; default: {} custom configurations


Demo

demo.gif

Online demo

https://codesandbox.io/s/nrw4w90o6p

License

MIT

0.1.0-beta.3

2 years ago

0.1.0-beta.1

2 years ago

0.1.0

2 years ago

0.1.1

2 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago