Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
How do you retain new lines and indentation when rendering text through JavaScript?

Sorry if wording is confusing. Basically, I want to store text in my database where it can be formatted like one would format a document. Here is a visual example of my problem and my desired result:

<script setup lang="ts">
    const contentFromDatabase = `
        This is one paragraph
        
        This is another paragraph
    `;
</script>

<template>
    <div class="test-component">
        <h1>{{ contentFromDatabase }}</h1>
    </div>
</template>

<style lang="scss">
    .test-component {
        h1 {
            color: white;
        }
    }
</style>

This is what is being displayed:

enter image description here

This is what I want to be displayed:

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda