Skip to content

v0.1.0 — Paste as Markdown

Latest

Choose a tag to compare

@cclambie cclambie released this 02 Aug 11:36

Requires LibreOffice 26.2 or newer. This builds on the native Markdown filter that
arrived in 26.2; it will not install on earlier versions.

Paste Markdown from the clipboard into Writer as real formatting — headings, lists, tables
and links — instead of literal ## and **.

Install

Download libre-paste-md-0.1.0.oxt below and open it with LibreOffice, or use
Tools → Extension Manager → Add. Close LibreOffice first; installing while it runs
silently does nothing.

Then copy some Markdown and use the Paste as Markdown toolbar button,
Edit → Paste as Markdown, or Tools → Add-Ons.

No keyboard shortcut is bound by default — Ctrl+Shift+V belongs to Paste Special.
Bind one via Tools → Customize → Keyboard if you want it.

How it works

Parsing is delegated to LibreOffice's own Markdown filter, so CommonMark and GFM support
is inherited rather than reimplemented. The whole paste is a single undo step.

The non-obvious part is insertion. insertDocumentFromURL corrupts the document and its
undo record
when it has to merge its first paragraph into an existing one — pasting
mid-paragraph could destroy adjacent text that no amount of undo recovered. The extension
therefore never inserts at an arbitrary offset; it manoeuvres onto a paragraph boundary
first. The README has the measurements.

Verified

24 in-office tests, including a full clipboard-to-document round trip through the real
toolbar command.

Tested on Flatpak LibreOffice 26.2.3.2 on Linux only. Other platforms and packaging
should work but are not yet verified — reports welcome.

Checksum

e0ae16367b548cfc5dfb547a72da9838f21a1001d78b18177c085430f4887c9c  libre-paste-md-0.1.0.oxt