ether/ep_markdown

export broken

azrdev opened this issue · 10 comments

(copy from ether/etherpad-lite#2716 )

The markdown export has several flaws, the one I could remember and reproduce right now is the indentation in the second line of following example:

  • first
    • second
    • third

In the export of our installation second is wrongly indented twice. The

I'd be willing to dig into the markdown export, can you point me to how that is implemented? https://github.com/JohnMcLear/ep_markdown/blob/master/export.js#L31 looks like exporting is commented out?

There isn't much source code to look through so just take a dig about and have fun :)

I've started to work on this. Some pointers to the next one searching:

the markdown export, [...] how that is implemented?

It's (all) in https://github.com/JohnMcLear/ep_markdown/blob/master/exportMarkdown.js - The other files here mostly deal with the "Show Markdown" option.

More to come, PRs and issues

Other issues I've noticed:

  1. Headings get converted to #Heading instead of # Heading
  2. URLs get converted to \url{url} instead of [url](url) or ![name](url) for images.

Hey, I noticed export was broken for several formats, so I've tested them. This issue seems fitting to share my conclusions for the markdown export. The instance we use also has the plug-ins markdown v0.0.10, mediawiki v0.0.7 and headings2 v0.0.9

I made a testpad to see what in the exports didn't work properly. The document had

  • All six headings (see https://github.com/ether/ep_headings2 )
  • Plain text
  • A link
  • Bold, italic, striked through, underlined and bold AND italic text
  • A codeblock
  • Bullet points (unordered list) two indents deep
  • Ordered list two indents deep
  • A list with combination of ordered and unordered (one indent deep)
  • regular indentation (one indent and two indents deep)
  • superscript
  • subscript
  • colours (black, red, reen, blue, yellow, orange)

My conclusions:

  • Headers 4, 5 and 6 use spaces instead of prefixing #. Header4 has four spaces, header5 has six spaces, header6 has eight spaces.
    • I also filed an issue with the Headings repo, but I'm unsure where the problem lies ether/ep_headings2#20
  • Underlined text is placed between the text 'underline' (there's no real convention in markdown I think, but maybe underscores '__' could do?)
  • striked throughs text is placed between the text 'out' (should be tildes '~~' I believe)
  • Code isn't formatted. Should be treated as a codeblock. (by adding ``` above and under the block of text)
  • After the lists I had a newline, some text and then again a newline. This is now changed to some text and two newlines. (It looks like it removes a newline and adds it after the next line...)
  • regular indentation is shown as bulletpoints, only one deep (so two indents deep was only one deep after export)
  • Coloured text also doesn't export, but that's expected I assume since markdown doesn't have colours

most issues fixed, code stlil to do. took 15 mins.. can't believe how old this issue is 👯‍♂

Please pull / install and test, it's live on npm. Code will be fixed ASAP.

Thx, but I now get Cannot GET /p/test-export/export/markdown :(

I removed the plug-in via the plug-in manager and then installed it again. It's now at version 0.1.5. I then opened a pad and tried exporting.

What version of Etherpad?

Version number: 1.7.5

I tested on a vm, but have put a test instance on my server now so it's publicly available in case you want to see what's happening. https://pad.ilja.space/p/test-export
The package I install from is https://github.com/YunoHost-Apps/etherpadlite_ynh
If it helps to have access to the admin panel, I can also give it assuming I can send you a private message. If there are any logs that can help, I can also give them assuming I know where to look.

In case it helps; these are the currently installed plugins on the instance (I see that the markdown is 0.1.6 now, but the problem is still the same).

Name Description Version
align Add Left/Center/Right/Justify to lines of text in a pad 0.1.25
author_hover Adds author names to span titles (shows on hover), works as authors change their name. Hover includes author color and fast switching between author spans. Hat tip to Martyn York for the initial work on this. 0.0.17
automatic_logut Automatically disconnects user after some period of time 1.0.8
comments_page Adds comments on sidebar and link it to the text. Support for Page View, requires ep_page_view 0.0.35
countable Displays paragraphs, sentences, words and characters counts. 0.0.7
delete_empty_pads Delete pads which were never edited 0.0.4
font_color Apply colors to fonts 0.0.11
headings2 Adds heading support to Etherpad Lite. Includes improved suppot for export, i18n etc. 0.0.10
markdown Edit and Export as Markdown in Etherpad 0.1.6
mypads Groups and private pads for etherpad 1.7.6
page_view Add support to do 'page view', with a toggle on/off option in Settings, also Page Breaks with Control Enter 0.5.24
spellcheck Add support to do 'Spell checking', with a toggle on/off option in Settings 0.0.4
subscript_and_superscript Add support for Subscript and Superscript 0.0.3
table_of_contents View a table of contents for your pad 0.1.15
user_font_size User Pad Contents font size can be set in settings, this does not effect other peoples views 0.0.1

You need latest Etherpad. 1.8 afaik?