Bug 168833 - Markdown heuristics interfere with plain text paste
Summary: Markdown heuristics interfere with plain text paste
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
26.2.0.0 alpha0+ master
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0
Keywords: regression
Depends on:
Blocks: Paste Markdown
  Show dependency treegraph
 
Reported: 2025-10-13 15:03 UTC by Aron Budea
Modified: 2025-10-16 07:10 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2025-10-13 15:03:57 UTC
Copy the following text between the ---- markers, paste into a text editor and copy from there (to get rid of any HTML coming from the browser):
----
a
b
c

- d
----

When pasting into Writer, result looks like this (individual paragraphs are gone):
----
a b c
    • d
----

The problem is the "- d" line. I'd say a list isn't specific enough to markdown to identify it as markdown format, unless perhaps if the document already contains markdown.

Observed using LO 26.2.0.0.alpha0+ (fbbbc56214d4a1fa72bb2453ad0f321294ad8049) / Windows.
Comment 1 Ujjawal Kumar 2025-10-14 04:50:33 UTC
(In reply to Aron Budea from comment #0)
> Copy the following text between the ---- markers, paste into a text editor
> and copy from there (to get rid of any HTML coming from the browser):
> ----
> a
> b
> c
> 
> - d
> ----
> 
> When pasting into Writer, result looks like this (individual paragraphs are
> gone):
> ----
> a b c
>     • d
> ----
> 
> The problem is the "- d" line. I'd say a list isn't specific enough to
> markdown to identify it as markdown format, unless perhaps if the document
> already contains markdown.
> 
> Observed using LO 26.2.0.0.alpha0+
> (fbbbc56214d4a1fa72bb2453ad0f321294ad8049) / Windows.

Could you provide suggestions for additional checks to confirm if a file qualifies as a Markdown document?
Comment 2 Ujjawal Kumar 2025-10-14 04:57:05 UTC
We could still paste as unformatted text using paste special and ctrl+shift+v without any markdown interference.
Comment 3 BogdanB 2025-10-14 05:15:52 UTC
Confirm with
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: dc33e6bbcd3132036eff1069834348ea67de8cee
CPU threads: 16; OS: Linux 6.14; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 4 Miklos Vajna 2025-10-14 06:18:35 UTC
Ujjawal: my idea would be to simply drop the OList and UList regexes -- typical markdown input will have one of bold, italic, URL or heading still. Would that work for you?
Comment 5 Ujjawal Kumar 2025-10-14 15:01:22 UTC
(In reply to Miklos Vajna from comment #4)
> Ujjawal: my idea would be to simply drop the OList and UList regexes --
> typical markdown input will have one of bold, italic, URL or heading still.
> Would that work for you?

That completely works for me, I will upload a patch soon.
Comment 6 Commit Notification 2025-10-16 07:10:01 UTC
Ujjawal Kumar committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/11a6dba109b84344d675a74dbc5da3887ca01bc2

tdf#168833 Remove check for olist and ulist to improve markdown heuristics

It will be available in 26.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.