vue3-prism

A project for displaying more beautiful and elegant code block in website based in Vue 3 and Prism.js.
15,666 1
Install
npm install vue3-prism
Latest Version:0.1.4
Vue:3
License:MIT
Last Updated:Aug 3, 2022
Links: GitHub  ·  npm
Maintainer: 321paranoiawhy

Vue3-Prism

This is a project for displaying more beautiful and elegant code block in website based in Vue 3 and Prism.js.

Clone Project

git clone https://github.com/321paranoiawhy/Vue3-Prism

Compiles and hot-reloads for development

# alias
npm run s # npm run service

Compiles and minifies for production

# alias
npm run b # npm run build

Build a single entry as a library

npm run lib

Reference:

Examples

Usage

Install

npm - vue3-prism

npm i vue3-prism

Global Registration

In main.js:

// main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import Vue3Prism from 'vue3-prism/lib/Vue3Prism.common.js'
import "vue3-prism/lib/Vue3Prism.css"

createApp(App).use(store).use(router).use(Vue3Prism).mount('#app')

As long as you have registered globally, then you can use Vue3Prism anywhere you want. It may just like this:

<!-- HelloWorld.vue -->
<template>
<!-- just pass source code in -->
    <Vue3Prism
        source="function bubbleSortFromStartToEnd(array) {
    const { length } = array;
    for (let i = 0; i < length - 1; i++) {
        for (let j = 0; j < length - i - 1; j++) {
            if (array[j] > array[j + 1]) {
                [array[j], array[j + 1]] = [array[j + 1], array[j]];
            }
        }
    }
    return array;
}"
    ></Vue3Prism>
</template>

<script>
export default {
    name: "HelloWorld",
};
</script>

Reference:

Local Registration

To be continued...

Reference:

Related Packages

vue-code-highlight

Beautiful code syntax highlighting as Vue.js component.

218,296 122
vue-prism-editor

A dead simple code editor with syntax highlighting and line numbers.

3,560,154 755
vue-use-gesture

Vue hook for receiving gestures https://vue-use-gesture.netlify.app

36,138 150
@iodigital/vite-plugin-prism

Prism, OpenAPI mocking server, integration for Vite

3,762 4
um-note

基于prismjs和vue3的语法高亮组件,支持编辑和提交! Syntax highlighting component ba...

5,636 2

Version History

Version Released License
0.1.4 MIT
0.1.3 MIT
0.1.2 MIT
0.1.1 MIT
0.1.0