Bug 160734

Summary: Support exporting to Markdown
Product: LibreOffice Reporter: Eyal Rozenberg <eyalroz1>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: enhancement CC: heiko.tietze, stephane.guillou, thb, vsfoote
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: All   
URL: https://en.wikipedia.org/wiki/Markdown
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=94978
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108254    

Description Eyal Rozenberg 2024-04-19 13:37:22 UTC
Markdown is a commonly used text-based format with simple(ish) direct formatting and a few structural elements (e.g. tables, block-quotes, code blocks). It is relatively popular, especially on web-based platforms (e.g. discourse installation, GitHub & GitLab). See:

https://en.wikipedia.org/wiki/Markdown 

It would be useful if we could take a Writer document, and export it into a Markdown document. 

Notes:

* There's a similar request regarding Calc: bug 94978.
* Standardization for MarkDown is a bit problematic, with some fracturing regarding what constitutes the standard. https://commonmark.org may be relevant, but isn't the only option.
Comment 1 Stéphane Guillou (stragu) 2024-04-19 14:11:28 UTC
Import and Export filters are good, less controversial first steps in Markdown support. But as you said, the challenge is picking a flavour.

Exporting to .md would simplify drastically the document to whatever the flavour allows.
(In reply to Eyal Rozenberg from comment #0)
> * There's a similar request regarding Calc: bug 94978.
(I consider "Save As" to be very different, and a lot more difficult to implement, as it would imply that LO supports _editing_ markdown files. And for that, we'd need to accommodate markup editing + rendered view somehow (.e.g by repurposing the Web View), possibly with a stripped down UI that only offers what the format supports.)

In any case, +1 for me.
Design/UX team?
Comment 2 Eyal Rozenberg 2024-04-19 15:54:06 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)
> (I consider "Save As" to be very different, and a lot more difficult to
> implement, as it would imply that LO supports _editing_ markdown files.

The opening comment of the other bug says "One way I could imagine such a support is by export tables created in Calc to Markdown syntax."

Also, I'm not sure how exactly you're making that distinction. If you can import a file format and export to it, then your app is an editor of that format. Perhaps not a great editor, nor an editor with "idempotence" over import-then-export, but an editor nonetheless.

... but maybe I'm misunderstanding?

Also note I am not asking for Markdown _import_ support, at least not with this bug.
Comment 3 Eyal Rozenberg 2024-04-19 15:55:00 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)
> Import and Export filters are good, less controversial first steps in
> Markdown support. But as you said, the challenge is picking a flavour.

Right. And I know I said CommonMark, but then - Tables are important :-)
Comment 4 Antonio Vidal 2024-04-19 22:53:22 UTC
> Markdown support. But as you said, the challenge is picking a flavour

Would propose Markdown-it due to being 100% compliant with CommonMark, secure by Google, and extensible with plugins

https://github.com/markdown-it/markdown-it
Python port: https://markdown-it-py.readthedocs.io/en/latest/#
Experimental Rust port: https://github.com/chrisjsewell/markdown-it-pyrs

Table and strikethrough from GFM flavour are implemented natively, and more features can be added via extensions
https://markdown-it-py.readthedocs.io/en/latest/plugins.html
Comment 5 Heiko Tietze 2024-04-21 07:36:53 UTC
Nothing to decide for UX. But there was a lot of acceptance in the design Telegram channel for adding markdown filters. Same request in bug 94978 - we should make one a duplicate.
Comment 6 Eyal Rozenberg 2024-04-21 07:57:14 UTC
(In reply to Heiko Tietze from comment #5)
> Same request in bug 94978 - we should make one a duplicate.

That bug seems to be calc-specific and tables-focused. I don't object to unifying the bugs, but the one that stays up needs to be generalized.