Skip to content

Lexxy remove empty lines on pasting texts #714

@AbdullahMedhat

Description

@AbdullahMedhat

When pasting plain text, Lexxy converts it through marked (markdown parser):

  #pasteMarkdown(text) {                                                                                   
    const html = k(text);  // k is the marked library                                                      
    this.contents.insertHtml(html, { tag: [ Fn ] });                                                       
  }                                                                                                        

The marked library (v16.4.1) is called with default options, which means:

  1. breaks: false (default) - Single newlines become spaces, not
    tags
  2. Standard Markdown behavior - Empty lines between paragraphs collapse into single paragraph boundaries

In Markdown, consecutive empty lines don't produce multiple
tags or empty paragraphs - they just
separate paragraphs.

Example of what happens:
Line 1

Line 2

Line 3
Becomes:

Line 1

Line 2

Line 3

(No empty paragraph between Line 2 and Line 3)

To fix this, Lexxy would need to call marked with { breaks: true } or use a custom renderer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions