All Projects → elisiondesign → vue-code-highlight

elisiondesign / vue-code-highlight

Licence: MIT License
Beautiful code highlighter as Vue.js component.

Programming Languages

CSS
56736 projects
javascript
184084 projects - #8 most used programming language
Vue
7211 projects
HTML
75241 projects

Projects that are alternatives of or similar to vue-code-highlight

winprint
winprint 2.0 - Advanced source code and text file printing. The perfect tool for printing source code, web pages, reports generated by legacy systems, documentation, or any text or HTML file. It works interactively or from the command line making it great for single users or whole enterprises. Works great with Powershell.
Stars: ✭ 52 (-45.83%)
Mutual labels:  syntax-highlighting, prismjs
prism
🧛🏻‍♂️ Dark theme for Prism.js
Stars: ✭ 33 (-65.62%)
Mutual labels:  syntax-highlighting, prismjs
KodeEditor
A simple code editor with syntax highlighting and pinch to zoom
Stars: ✭ 60 (-37.5%)
Mutual labels:  syntax-highlighting
rich
Rich is a Python library for rich text and beautiful formatting in the terminal.
Stars: ✭ 36,988 (+38429.17%)
Mutual labels:  syntax-highlighting
QSourceHighlite
Lightweight syntax highlighter written in Qt
Stars: ✭ 39 (-59.37%)
Mutual labels:  syntax-highlighting
ManDrake
Native Mac man page editor with syntax coloring, mandoc syntax checking & live preview.
Stars: ✭ 130 (+35.42%)
Mutual labels:  syntax-highlighting
stan-vim
A Vim plugin for the Stan probabilistic programming language.
Stars: ✭ 41 (-57.29%)
Mutual labels:  syntax-highlighting
myPortfolio
This is a portfolio application built by using Next.js, ChakraUi, Typescript and Dev.to api.
Stars: ✭ 127 (+32.29%)
Mutual labels:  prismjs
night-owlish
🌙🦉 An RStudio, tmThemes, and Ace editor adaptation of @sdras' Night Owl VS Code theme…
Stars: ✭ 122 (+27.08%)
Mutual labels:  syntax-highlighting
Sublime-GenericConfig
Generic highlighting of the configuration files for Sublime Text 2 and Sublime Text 3
Stars: ✭ 39 (-59.37%)
Mutual labels:  syntax-highlighting
vscode-cue
CUE language support for Visual Studio Code
Stars: ✭ 55 (-42.71%)
Mutual labels:  syntax-highlighting
vim-vgo
Vim syntax highlighting for golang.org/x/vgo go.mod
Stars: ✭ 28 (-70.83%)
Mutual labels:  syntax-highlighting
JCEditor
📝 Text editor created in Java
Stars: ✭ 33 (-65.62%)
Mutual labels:  syntax-highlighting
Laravel.tmTheme
A Sublime Text 3 theme based on the Laravel documentation colour scheme
Stars: ✭ 40 (-58.33%)
Mutual labels:  syntax-highlighting
Clojure-Sublimed
Clojure support for Sublime Text 4
Stars: ✭ 268 (+179.17%)
Mutual labels:  syntax-highlighting
tree-sitter-sql
SQL syntax highlighting for tree-sitter
Stars: ✭ 33 (-65.62%)
Mutual labels:  syntax-highlighting
enhanced-slack
🌴 PoC Slack enhancer/injector
Stars: ✭ 48 (-50%)
Mutual labels:  syntax-highlighting
splash
🌊 Highlight source code embedded in HTML with a splash of color
Stars: ✭ 19 (-80.21%)
Mutual labels:  syntax-highlighting
fastedit
安卓端高性能输入框。
Stars: ✭ 38 (-60.42%)
Mutual labels:  syntax-highlighting
see-cli
A colorful 🌈 cat - syntax highlight print CLI
Stars: ✭ 24 (-75%)
Mutual labels:  syntax-highlighting

vue-code-highlight

Beautiful code syntax highlighting as Vue.js component.

Examples

https://codesandbox.io/s/vue-code-highlight-example-63h5m screenshot

Usage

npm install vue-code-highlight --save

Now, you can use this module in two diferrent ways, as a component or as a directive.

Component

In any component:

// You have to extract the component from the module
import { component as VueCodeHighlight } from 'vue-code-highlight';

components:{
  VueCodeHighlight,
  ...
}
<vue-code-highlight language="javascript">
  <pre>
 //Paste your code here
 </pre>
</vue-code-highlight>

Props

Prop Description
language Pass language name you want to highlight. Options: https://prismjs.com/#supported-languages

Your content will be highlighted dynamically when it updates.

The <pre> tag is required to preserve newline characters (They're stripped by default in Vue).

Window styles are already present in a component mode, but you will need to select and include a theme to properly highlight your code. (See the themes section.)

Directive

In your main file:

import VueCodeHighlight from 'vue-code-highlight';

Vue.use(VueCodeHighlight) //registers the v-highlight directive

And then in any Vue component:

<div v-highlight >
 ...
</div>

All markup under the div element having the following structure will be syntax highlighted.

<pre class="language-javascript">
  <code>
    //your code goes here
  </code>
</pre>

To give the highlighter a window look in a directive mode, also don't forget to include the ./node_modules/vue-code-highlight/themes/window.css file somewhere in your app.

Themes

In order to visually higlight your code, you need to select a theme from ./node_modules/vue-code-highlight/themes/ and import it somewhere into your component/application. These are just regular prism themes, so feel free to improvise.

themes

Other languages

Any of the supported languages in Prism may be used. To enable support for them, you must import them explicitly as well as Prism's markup templating.

For example, to include PHP highlighting in your application:

import 'prism-es6/components/prism-markup-templating';
import 'prism-es6/components/prism-php';
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].