Socket
Socket
Sign inDemoInstall

@aminoeditor/vue-prism

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aminoeditor/vue-prism

Easily integrate Prsim.js code highlighting into Vue.js


Version published
Weekly downloads
14
increased by1300%
Maintainers
1
Install size
3.79 kB
Created
Weekly downloads
 

Readme

Source

Install

npm install --save prismjs @aminoeditor/vue-prism

Add to vue Globally main.js

import Vue from 'vue';
import VuePrism from '@aminoeditor/vue-prism';

Vue.use(VuePrism);

// the rest of main.js below

Component

<template>
	<prism language="css" :code="code"></prism>
</template>

<script>
// you can import the language libs you need from
// prismjs here...or pretty much anywhere in your app
import  'prismjs/themes/prism.css';

export default {
	data () {
		return {
			code: 'body { background: blue; }'
		}
	  }
}
</script>

Directive

<code v-prism:css>body { background: blue; }</code>

Add to vue Locally MyComponent.vue

import { VuePrismComponent as prism } from '@aminoeditor/vue-prism';
export default {
	components: {
		prism
	}
}

Plugin Support

Normalize Whitespace (component only)

<template>
	<prism language="css" :code="code" :pluginConfigs="pluginConfigs"></prism>
</template>

<script>
import 'prismjs/themes/prism.css';

export default {
	data () {
		return {
			code: 'body { background: blue; }',
			pluginConfigs: {
				whitespace: {
					'remove-trailing': true,
					'remove-indent': true,
					'left-trim': true,
					'right-trim': true,
					'break-lines': 80,
					'indent': 1,
					'remove-initial-line-feed': false,
					'tabs-to-spaces': 4,
					'spaces-to-tabs': 4
				}
			}
		}
	}
}
</script>

Keywords

FAQs

Last updated on 03 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc