Socket
Socket
Sign inDemoInstall

vue-raw-pre

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-raw-pre

A what-you-see-is-what-you-get preformatted code tag for Vue. `vue-raw-pre` exposes a single slot that outputs whatever you put into it verbatim.


Version published
Maintainers
1
Install size
357 kB
Created

Readme

Source

vue-raw-pre

A what-you-see-is-what-you-get preformatted code tag for Vue.
vue-raw-pre exposes a single slot that outputs whatever you put into it verbatim.

Vue templateRenders in browser
<pre>
  <code>
    <button>
      <octocat />
    </button>
  </code>
</pre>
Octocat mark image
<v-raw-pre>
  <button>
    <octocat />
  </button>
</v-raw-pre>
<button>
  <octocat />
</button>
<pre>
  <code>
    <span>{{ 1 + 2 }}</span>
  </code>
</pre>
3
<v-raw-pre>
  <span>{{ 1 + 2 }}</span>
</v-raw-pre>
<span>{{ 1 + 2 }}</span>

vue-raw-pre is great for writing technical documentation and code samples for your projects.

Installation

In your project folder:

yarn add vue-raw-pre --dev

In vue.config.js:

const addVueRawPreLoader = require("vue-raw-pre");

module.exports = {
  chainWebpack: (config) => {
    addVueRawPreLoader(config);
  },
};

In your template:

<v-raw-pre>
  ...
</v-raw-pre>

Props

By default, vue-raw-pre trims leading and trailing empty lines and dedents your code to the smallest common alignment.

To disable newline trimming, set no-trim on the tag.

<v-raw-pre no-trim>
  ...
</v-raw-pre>

To disable automatic code dedenting, set no-dedent on the tag.

<v-raw-pre no-dedent>
  ...
</v-raw-pre>

Setting both is naturally valid as well.

Technical details

Internally, vue-raw-pre works as a Webpack loader for .vue files. This allows it to escape tag contents before they're bundled by Vue's loaders.

This means that no component registration in required, the tag doesn't exist in your final bundle.

Currently only HTML templates in SFCs are supported.

FAQs

Last updated on 19 Apr 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc