Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-nl2br

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-nl2br

A vue component that turns new lines into line breaks.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-60.03%
Maintainers
1
Weekly downloads
 
Created
Source

vue-nl2br

A vue component which turns new lines into line breaks.

Why not just use CSS?

See Why not just use CSS white-space: pre;? · Issue #7

Requirement

  • Vue.js ^2.0.0

Installation

npm install --save vue-nl2br

Usage

<nl2br tag="p" :text="`myLine1\nmyLine2`" class-name="foo bar" />

is rendered to

<p class="foo bar">myLine1<br>myLine2</p>

(1) Global registration

https://vuejs.org/v2/guide/components.html#Registration

import Vue from 'vue'
import Nl2br from 'vue-nl2br'

Vue.component('nl2br', Nl2br)

(2) Local registration

https://vuejs.org/v2/guide/components.html#Local-Registration

// MyComponent.vue

<template>
  <nl2br tag="p" :text="`myLine1\nmyLine2`" />
</template>

<script>
import Nl2br from 'vue-nl2br'

export default {
  name: 'MyComponent',
  components: {
    Nl2br,
  },
  // ...
}
</script>

Props

  • tag: HTML tag name which is passed to createElement function
    • Type: String
    • Required: true
  • text: Text in the tag.
    • Type: String
    • Required: true
  • className: HTML class name(s)
    • Type: String
    • Required: false

License

MIT

Keywords

FAQs

Package last updated on 20 Jul 2019

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc