Transferring Markdown Documents to LibreOffice

To divert a little, but not talking about Markdown.

We were looking for a simple way of of producing documents in html,
thought we were on the right track until some of the potential users
asked for pdf too. We now use Lyx for the authoring, it produces
formatted text, without formatting marks having to be typed in.

From the Lyx master, we output in pdf and html, with DVI and xhtml
available as options. Where Open Document format is needed, the html
can be directly pasted in to .odt, but with one failing. A Table of Contents
in Lyx loses the page links in the paste function . There is an easy
work-around, just create a new ToC in Libre Office - about 4 clicks,
and delete the original ToC.

Gordon Cooper

MX-Linux Documentation Team
Tauranga N.Z.

You can do much the same with LO itself.

I've always loved the PDF output from LO's PDF converter. For some
reason I've never been able to figure out, its PDF output seems sharper
and crisper than the PDF output created by other programs, including
LaTeX or LyX. It may just be me.

I've also been impressed with LO's HTML output. It has a couple
different options, either of which which will produce a fairly simple
HTML file which can easily be edited further with any text editor.

And, where an OpenDocument file is needed, you have it without any need
for further conversion.

I confess I'm fairly OCD when it comes to my endless search for the
perfect document creation tool (which of course doesn't exist). In the
FOSS world, I've tried everything from LO to LaTeX, LyX, Markdown, and
ReStructuredText, but I almost always come back to LO.

I usually try one of the other alternatives when I need to do something
LO won't do only to learn later that LO would have done it quite well if
I had only taken the time to learn it.

Virgil

Interesting but I want to emphasize that this is not a solution for what I seek to accomplish.

Again, this is not what I am trying to do and of course I am aware that any OO/LO document has lots of formatting and options that markdown lacks that would be lost going from OO/LO, that's the reason for using markdown.

My focus - which the other users understood - is to focus on the content of the document, using OO/LO later to polish the presentation of the content.

Although I did not mention it, there are also several markdown editors running on Android phones and tablets allowing me to work on document content on the go.

I will confess my denseness, but I've read your explanation of what you
want several times, and I'm not sure I understand what you want. My
response below was to another user who was talking about using LyX. It
was not intended to address your original post as I don't understand
your desire.

What I *think* you're saying is that you want to write in Markdown, with
all the #Headings and *italics* code and then have LO automatically
convert that to its own formatted Headings and italics, etc. I don't
know of any converter (other than, perhaps, Pandoc) that can do that.

I have used a converter to go from ReStructuredText (a markup language
similar to Markdown) to .ODT, but it doesn't work very elegantly. One
reason is there are so many different way of formatting something in LO,
the converter doesn't know which way you might prefer. For example, LO
can format a heading directly or through paragraph styles with or
without automatic numbering. If you try to convert a Markdown #Heading
to LO, your converter won't know if you want direct formatting or
formatting with a paragraph style. My experience is that most converters
convert to direct formatting, which then means I have to go back and
change it all to styles, which sort of defeats the purpose of the
conversion.

You then mention wanting to create presentations from your Markdown.
There again I'm confused. Markdown's purpose is to be a front end to
HTML which is a continuous stream of content formatted for a web
browser. When I hear the word "presentation," I think in terms of LO
Impress or MS Powerpoint. Those formatted documents are *very* different
from what you get with HTML.

So, if you're trying to write in Markdown and end up with a document
that looks like a Powerpoint presentation, I think what you're asking
for is very ambitious, especially since Markdown wasn't intended for
that type of document. But, if you're using "presentation" in a
different sense, then I go back to my original comment, I don't
understand what you want.

Good luck with your efforts

Virgil

I have installed pandoc and tried to converted two markdown documents to ODT opening them in LibreOffice 4.3.7 under CentOS 6.8.

It seems Pandoc modifies the LO styles, setting fonts to Arial, Times Roman etc. which are not available in LO. Pandoc also did not assign the default list style to lists, nor did it handle tables at all. Although tables are not part of the core markdown they are part of a common extension.

I would have preferred pandoc to use whatever the style settings are in LO, not trying to change anything.

Hello,

H. @ 2016-11-27 19:00 GMT:

<snip>

Since Markdown is a pure text file with formatting marks inserted, you
could easily edit such a file with LO. It sounds like what you're asking
is a way to convert the Markdown file to a LO format. I'm not sure of a
direct way of doing that. You might try Pandoc, an online file converter.

<snip>

Pandoc can be installed on any system, but only recent versions support ODT, so you need to look with version if offered by CentOS

http://pandoc.org/

Regards,
Ricardo

I have installed pandoc and tried to converted two markdown documents to ODT opening them in LibreOffice 4.3.7 under CentOS 6.8.

It seems Pandoc modifies the LO styles, setting fonts to Arial, Times Roman etc. which are not available in LO. Pandoc also did not assign the default list style to lists, nor did it handle tables at all. Although tables are not part of the core markdown they are part of a common extension.

I would have preferred pandoc to use whatever the style settings are in LO,
not trying to change anything.

Actually it does not work that way; pandoc cannot guess what styles are used
by LibreOffice. If you have written your two documents using markdown they
simply cannot use LibreOffice styles "in advance". I think that what's really
going on with Pandoc is that it has default settings for each type of export
filters. Arial and Times Roman are fairly common fonts and by default
LibreOffice can use them with no problem.

On the other hand, using Markdown in my experience does not really make me
expect to have nicely laid out documents (like with LibreOffice or LATEX for
instance). Markdown is fundamentally a web and transitional format, made to
process text on websites or online documentation. If you are looking for rich
and complex styles I suggest to stick to LibreOffice or other kinds of tools
such as LATEX.

Best,

Hello,

H. @ 2016-11-27 19:00 GMT:

<snip>

Since Markdown is a pure text file with formatting marks inserted, you
could easily edit such a file with LO. It sounds like what you're asking
is a way to convert the Markdown file to a LO format. I'm not sure of a
direct way of doing that. You might try Pandoc, an online file converter.

<snip>

Pandoc can be installed on any system, but only recent versions support ODT, so you need to look with version if offered by CentOS

http://pandoc.org/

Regards,
Ricardo

I have installed pandoc and tried to converted two markdown documents to ODT opening them in LibreOffice 4.3.7 under CentOS 6.8.

It seems Pandoc modifies the LO styles, setting fonts to Arial, Times Roman etc. which are not available in LO. Pandoc also did not assign the default list style to lists, nor did it handle tables at all. Although tables are not part of the core markdown they are part of a common extension.

Does CentOS 6.8 have access to the "ttf-mscorefonts-installer" package?

This package includes Arial and Times New Roman and many of the core fonts you get with a Windows install. I use the DEB package, but hopefully there is a RPM package as well.

On my main laptop, I have Arial in "normal" style, monospaced, condensed, narrow, and rounded font sets.

Actually, I have over 180 fonts in my ".font"folder, and have over 14GB of font files on my "file server".

Hi Tim

Does CentOS 6.8 have access to the "ttf-mscorefonts-installer" package?

This package includes Arial and Times New Roman and many of the core
fonts you get with a Windows install. I use the DEB package, but
hopefully there is a RPM package as well.

On my main laptop, I have Arial in "normal" style, monospaced,
condensed, narrow, and rounded font sets.

Actually, I have over 180 fonts in my ".font"folder, and have over 14GB
of font files on my "file server".

No need to add fonts, LibreOffice will substitute quite easily with the Liberation family of fonts which are pretty well identical to Arial, the same with Times font. No need to install any MS fonts if you don't need to. The fonts shipped with LibreOffice are such that they will offer the largest success with respect to interoperability with fonts.

Marc

My point exactly: pandoc knows that I am converting from markdown format to LO format. It should not define new fonts or font sizes for the various parts of the markdown document, only make anything tagged Header Level 1 in the markdown document become Header 1 in LO accepting whatever font, font size and other style information I have defined in LO. It should not convert Header Level 1 in markdown to Times, Arial or any other font at all, this has nothing to do with whether LO has compatible fonts or not.

I have never tried to use my markdown editor for defining "rich and complex styles" and I thought I had made that clear several times.

I think there are frequent misunderstandings on list why and how some users want to use a markdown editor to create document content leaving the formatting to LO, OO or whatever their word processor - or slide presentation package - is.

I would like to add that I have pandoc 1.9.4.1 on my computer running CentOS 6.8, apparently pandoc 1.10 has expanded support for markdown to also include tables and other features.

Thank you for the information but irrelevant. Pandoc should not define any font information at all when exporting from markdown to LO.

I know that but the point is that pandoc seems to have defined certain fonts for the various elements in a markdown document which it should not. It is irrelevant whether LO has substitutable fonts or not.

There is a utility called MultiMarkdown that will write flat ODF files
readable by LO.

MultiMarkdown has been suggested by its author Fletcher Penney and it does sound interesting. Unfortunately I could not get it to work on the only Windows system I have - running Vista - and I am not sure I could compile it for CentOS. Fletcher has not responded to the first issue.

Please do not send replies to me personally, this is a mailing-list discussion and I am - obviously - a member of the mailing list and the discussion is for the benefit of those members who have an interest in markdown and LO. Private replies are a waste of bandwidth and as welcome as spam.

​I've started writing a markdown conversion tool for another purpose, but
it would be relatively trivial for me to output fodt; do you have a
reference to the markdown you use? As I understand it, there are a lot of
variation of it.

(sorry if it was said before in the thread, but it's been a lenghty one).

That would certainly be terrific! My understanding is also that markdown was invented by Gruber and that there are multiple extensions. I would propose Fletcher Penney's syntax summary for MultiMarkdown, see https://rawgit.com/fletcher/human-markdown-reference/master/index.html.

Let me restate that when converting to LO/OO format, the converter should not impose /any/ style information whatsoever, not use a particular font, a particular style etc. If I - in LO - have defined the font cvayfgappt23mpat at 12.74 points to be the font for Headings Level 2 that should be used and if I have font y0gagöaqgfy 37.902 points for body text that should be used, no assumptions about fonts, languages etc. My understanding is that a LO document always has certain styles defined, including Header 1, Header 2, Text Body, Table Header etc. and whatever I have defined those as in LO would be used by LO.

As I understand it, H wants to convert markdown to odf AND BACK to markdown. Most of the messages in this thread are ignoring that last step.

While it would be very nice to be able to revert to markdown, that may not be very workable...

Yes, I know that.

The question seemed to state that they wanted/needed Arial and Times New Roman specifically. So I made my comment about how to get it.

I do use a lot of "compatible" or "similar" fonts so I get what I want/need without paying for the "name brand" font's price. For Liberation, I have the Mono, Serif, Sans Serif, and Sans Serif Narrow, versions installed. Sometimes I have both Narrow and Condensed versions of fonts, when they seems to be different. Liberation only has Narrow, but Arial seems to have both.

My only trouble for font selection is when I am dealing with a Windows user that uses Word, not LO, who need the document[s] to have fonts specific to their Windows system. That was one reason I installed the MS Core Fonts package.

Just did it... :wink: