Bug 162153 - Support importing Markdown files
Summary: Support importing Markdown files
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Format-Filters
  Show dependency treegraph
 
Reported: 2024-07-23 09:32 UTC by Eyal Rozenberg
Modified: 2024-08-07 11:03 UTC (History)
4 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 Eyal Rozenberg 2024-07-23 09:32:17 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 open a Markdown document in Writer, and get it "rendered" with appropriate styles. i.e. we should be able to import Markdown into Writer.

Note:

* Bug 160734 regards the ability to export to Markdown.
Comment 1 Eyal Rozenberg 2024-07-23 09:37:35 UTC
(In reply to Buovjaga from comment #8 on bug 160734)
> (In reply to Antonio Vidal from comment #4 on bug 160734)
> > > 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
> 
> Those are not for export, but for import. For import, an easier integration
> would probably be this C-based lib: https://github.com/mity/md4c
> 
> Note that when dealing with importing, valid Markdown files can contain any
> HTML.

1. Are you sure Markdown can contain _any_ HTML rather than just _some_ HTML?
2. Regardless - we could start with an input filter that doesn't support HTML, or with very limited HTML support (e.g. tags like a, b, em). This would already be useful.
Comment 2 Buovjaga 2024-07-23 09:51:50 UTC
(In reply to Eyal Rozenberg from comment #1)
> 1. Are you sure Markdown can contain _any_ HTML rather than just _some_ HTML?

https://spec.commonmark.org/0.31.2/#html-blocks

I sure have used any HTML I like in Markdown content when building the new LibreOffice site with Hugo.