1.0.5 • Published 6 months ago
pretty-xml-vue3 v1.0.5
Pretty Xml for Vue 3
Pretty XML is a simple XML viewer for Vue 3. The component formats and colors an XML document. You can reveal and hide the contents of tags. If you want to use Pretty XML in Nuxt, you should wrap it in ClientOnly
.
Demo
https://amfeon.github.io/PrettyXml/
Project Setup
npm install pretty-xml-vue3 --save
Usage
<script setup>
import { PrettyXml } from 'pretty-xml-vue3';
// content: string
const content = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> <url> <loc>https://example.com/news/651</loc> <lastmod>2022-08-04T15:46:40.285Z</lastmod> </url> <url> <loc>https://example.com/news/650</loc> <lastmod>2022-08-04T15:46:40.285Z</lastmod> </url> <url> <loc>https://example.com/news/649</loc> <lastmod>2022-08-04T15:46:40.285Z</lastmod> </url></urlset>'
</script>
<template>
<PrettyXml :xml="content" :options="{shortRecord:true}"/>
</template>
options: { shortRecord: Boolean } - optional value
Styles
You need manually import component's styles.
import "pretty-xml-vue3/style.css"
css-variable | value |
---|---|
--tag-name-color | rgb(207, 42, 42) |
--tag-content-color | rgb(0, 0, 0) |
--attribute-name-color | rgb(61, 133, 35) |
--attribute-value-color | rgb(42, 83, 207) |
--remark-color | rgb(134, 134, 134) |
--caret-name-color | rgb(134, 134, 134) |
You can redefine css variables to adapt to your design.
1.0.5
6 months ago
1.0.4
6 months ago
1.0.3
6 months ago
1.0.2
10 months ago
1.0.1
11 months ago
1.0.0
11 months ago
0.6.2
1 year ago
0.6.1
1 year ago
0.6.0
2 years ago
0.5.12
2 years ago
0.5.11
2 years ago
0.5.10
2 years ago
0.5.9
2 years ago
0.5.8
2 years ago
0.5.7
2 years ago
0.5.6
2 years ago
0.5.5
2 years ago
0.5.4
2 years ago
0.5.3
2 years ago
0.5.2
2 years ago
0.5.1
2 years ago
0.5.0
2 years ago