mquinson/po4a

Markdown fenced code-blocks wrongly handled

Closed this issue · 3 comments

While gettextizing a Markdown file using po4a 0.70, I noticed the issues below with code block handling. See reproducible scenario in fenced-example.zip.

1. The first code line of the code block is extract together with the fences**

This markdown text

```bash
command --argument filename
```

becomes the following translation string in the PO file:

```bash command --argument filename ```

2. Blank lines inside the code block are spliting strings**

Instead of the whole code block be presented in a single string, blank lines are splitting each group of lines in different strings:

This markdown test:

```bash
command --argument filename

command_after_blank_line

this_function_have_lines:
   one_command
   another_command
```

becomes the following translation strings in the PO file:

#. type: Plain text
#: fenced.md:11
msgid "```bash command --argument filename"
msgstr ""

#. type: Plain text
#: fenced.md:13
msgid "command_after_blank_line"
msgstr ""

#. type: Plain text
#: fenced.md:17
#, no-wrap
msgid ""
"this_function_have_lines:\n"
"   one_command\n"
"   another_command\n"
"```\n"
msgstr ""

just add -o markdown to your opt:

@Fat-Zer Is opt:"--keep 0" opt:"-o markdown" the correct syntax, considering the existing --keep 0 flag?

Nevermind, I found the answer in po4a(1) man page. Thanks!