ttscoff / mdless

MIT License
871 stars 39 forks source link

mdless does not render HTML escaped characters #64

Closed atsaloli closed 3 years ago

atsaloli commented 3 years ago

Hi again,

Is it possible for mdless to render HTML escaped characters, please? I need to be able to put a pipe into a markdown table.

[root@my-hostname-has-dashes source]# cat /tmp/ex.md
Logical operators (in order of precedence of operation)

| Operator   | Description |
|------------|-------------|
| `( )`      |  Grouper
| `!`        | NOT
| `&` or `.` | AND
| |     | OR

[root@my-hostname-has-dashes source]# mdless /tmp/ex.md
Logical operators (in order of precedence of operation)

+------------+-------------+
| Operator   | Description |
|------------|-------------|
| `( )`      | Grouper     |
| `!`        | NOT         |
| `&` or `.` | AND         |
| |     | OR          |
+------------+-------------+

[root@my-hostname-has-dashes source]# pandoc -o /tmp/example.txt /tmp/ex.md
[root@my-hostname-has-dashes source]# cat /tmp/example.txt
Logical operators (in order of precedence of operation)

  Operator     Description
  ------------ -------------
  `( )`        Grouper
  `!`          NOT
  `&` or `.`   AND
  |            OR

[root@my-hostname-has-dashes source]#

https://www.markdownguide.org/extended-syntax/#:~:text=Escaping%20Pipe%20Characters%20in%20Tables,(%20%7C%20) says:

You can display a pipe (|) character in a table by using its HTML character code (|).

Pandoc is able to handle this just fine.

ttscoff commented 3 years ago

Pandoc isn't outputting to the terminal. A lot of HTML entities would display poorly in many terminals, and I don't really want to add a whole lookup table to convert them. That's partly just laziness, but it's also a pretty large undertaking for a little command line utility.