Skip to content

Add preserveWhitespace on a per-component basis #6200

Closed
@martynchamberlin

Description

@martynchamberlin

What problem does this feature solve?

Take this component:

<template>
  <div>
    <span>Mark</span>
    <span>down</span>
  </div>
</template>

If preserveWhitespace is enabled in vue-template-compiler then this will get rendered on the page as this:

Mark down

I would have to resort to some sort of CSS to get around this, so that it instead renders as:

Markdown

What I would instead like is the ability to have preserveWhitespace enabled by default but have the ability to override this on a per-component basis. If that were an option then I could disable it for the above component and then it would render in HTML as this:

<div><span>Mark</span><span>down</span></div>

What does the proposed API look like?

I'm envisioning maybe a new top level property for the exported function within a single-file Vue component. E.g.:

export default {
  name: 'Markdown'
  preserveWhitespace: true
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions