🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more
Socket
Book a DemoInstallSign in
Socket

@tslsmart/code-view

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tslsmart/code-view

参考vue-code-view

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Vue Code View(VCV)

Build Status GitHub license npm npm bundle size npm

English | 简体中文

A lightweight code interaction component based on vue 2.x, which can edit, run and preview the code effect display in real time on the web page.

When reading docs that contain a lot of code, many project docs implement a render representation of the sample code via the markdown loader, but it is static. When we want to debug code, we generally need to open the local IDE or open online editor websites such as codepen, codesandbox, and it is also subject to whether the computer has a development environment installed or whether the network connection is smooth.

So can there be such a component that can support editing code in the page, edit, run and preview the code effect display in real time in the web page?

Special thanks to the component react-code-view, based on which the vue version of the component was written! Using this component, you can edit the running code and preview the effect in real time by using the multi-sample code in the vue page or the markdown document.

Online Demo

示例

demo address: https://andurils.github.io/vue-code-view/#/demo

codesandbox example: vue-code-view-example

✨ Features

  • 💻 Code can be edited online and preview the effect in real time.
  • 🎨 Support sample code highlighting, configure themes.
  • 🌈 Support <style> parsing and rendering.
  • 📑 Support Markdown file example rendering

📦 Install

npm i vue-code-view
# or
yarn add vue-code-view

🔨 Configure

Using vue cli requires configuration in the vue.config.js file, which supports the use of Vue builds that include the runtime compiler.

module.exports = {
  runtimeCompiler: true,
  // or
  chainWebpack: (config) => { 
    config.resolve.alias
      .set("vue$", "vue/dist/vue.esm.js");
  },
}; 

💻 Usage

Components are introduced in the entry file main.js, and there is no need to manually introduce styles.

import Vue from "vue";
import App from "./App.vue";
import CodeView from "vue-code-view";

Vue.use(CodeView);

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");

API

Attributes

参数说明类型默认值版本
themeModecode editor theme mode,default light`` | dark``
showCodeshow the code editor , only layout value is top takes effectbooleanfalse
sourcesource codestring-
layoutrender view layouttop | right | lefttop0.4.0

Changelog

Detailed changes for each release are documented in the release notes.

💡 Inspired

links.

License

VCV is licensed under the terms of the MIT License

Copyright (c) 2021-present Anduril

Keywords

vue

FAQs

Package last updated on 13 Jul 2022

Did you know?

Socket

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