Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/justforuse/vue-mathjax

Vue plugin with Mathjax
https://github.com/justforuse/vue-mathjax

mathjax vue vue-component

Last synced: about 5 hours ago
JSON representation

Vue plugin with Mathjax

Awesome Lists containing this project

README

        

# vue-mathjax

[![npm](https://img.shields.io/npm/v/vue-mathjax.svg) ![npm](https://img.shields.io/npm/dm/vue-mathjax.svg)](https://www.npmjs.com/package/vue-mathjax)
[![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)

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](https://github.com/justforuse/vue-mathjax-next)

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

## Table of contents

- [Installation](#installation)
- [Usage](#usage)

# Installation

```
npm install --save vue-mathjax
```

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

```
---
```
import VueMathjax from 'vue-mathjax'
Vue.use(VueMathjax)
```
OR
```
import {VueMathjax} from 'vue-mathjax'
export default {
...
components: {
'vue-mathjax': VueMathjax
},
...
```
```


<!-- 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'
}
}
}

```

# 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](https://github.com/justforuse/vue-mathjax/raw/master/demo.gif)
---
# Online demo
https://codesandbox.io/s/nrw4w90o6p
## License

[MIT](http://opensource.org/licenses/MIT)