Javascript Diff Objects Viewer Plugin For Vue.js

Vue diff viewer plugin that can be used to compare the difference between code snippets. You can see the difference between the two icons using the vue-diff plugin.

vue diff viewer example, javascript diff online, diff2html, javascript text diff, text diff npm, javascript diff objects, markdown diff tool

Features

  • Support split/combined mode
  • Support for multiple languages can be extended
  • Support two themes (dark/light) and can be customized
  • Default scroll to compare large text
  • Folding width (partial folding not supported)

How to make use of it:

Install and download:

# NPM
$ npm i vue-diff --save

1. Import and register a different viewer.

import VueDiff from 'vue-diff'
import 'vue-diff/dist/index.css'
app.use(VueDiff);

2. Add the component to the template.

<Diff />

3. Component props available.

mode: {
  type: String as PropType<Mode>,
  default: 'split' // or unified
},
theme: {
  type: String as PropType<Theme>,
  default: 'dark' // or light
},
language: {
  type: String,
  default: 'plaintext'
},
prev: {
  type: String,
  default: ''
},
current: {
  type: String,
  default: ''
},
inputDelay: {
  type: Number,
  default: 0
},
virtualScroll: {
  type: [Boolean, Object] as PropType<boolean|VirtualScroll>,
  default: false
}

4. Expand the plugin with Highlight.js.

// register a new language
import yaml from 'highlight.js/lib/languages/yaml'
VueDiff.hljs.registerLanguage('yaml', yaml)

Default supported languages and values

  • css
  • xmlxmlhtmlxhtmlrssatomxjbxsdxslplistsvg
  • markdownmarkdownmdmkdownmkd
  • javascriptjavascriptjsjsx
  • json
  • plaintextplaintexttxttext
  • typescripttypescriptts

Props

nametypedefaultvaluesdescription
modestringsplitsplitunified 
themestringdarkdarklightcustom${string}See Custom theme
languagestringplaintext See Extend languages
prevstring'' Prev code
currentstring'' Current Code
foldingbooleanfalse Folding not different
inputDelaynumber0 Setting up rendering debounce for changes for performance benefit (mode, prev, curr)
virtualScrollboolean|objectfalse Default value when setting true :
{ height: 500, lineMinHeight: 24, delay: 100 }

Diff Viewer Plugin, vue-diff Github


See Demo And Download

Official Website(hoiheart): Click Here

This superior jQuery/javascript plugin is developed by hoiheart. For extra Advanced usage, please go to the official website.

Related Posts

VenoBox-Responsive-jQuery-Lightbox-Plugin

Responsive Image Gallery Lightbox jQuery Plugin | VenoBox

VenoBox is a responsive jQuery modal window plugin suitable for images, embedded content, iFrames, Google Maps, Vimeo, and YouTube videos. The big difference compared to many other…

bootstrap-dropdown-on-hover

[Animation] Bootstrap Multi-Level Responsive Dropdown Menu

Bootstrap-based multi-level dropdown navigation menu with cool animations. The dropdown on Hover is a jQuery plugin used to create Bootstrap multi-level scroll-triggered dropdown menus with CSS3 animations…

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Leave a Reply

Your email address will not be published. Required fields are marked *