Markdown tables are generated without escaping pipe character
elkoudou opened this issue · comments
When a macro (and variables I guess) has a definition or description containing the pipe character "|", it is not escaped and causes missing text in the public description tables.
For instance, let's consider the following code:
/** Test macro
*/
#define MY_MACRO (A | B)
Doxybook will generate:
| Type | Name | | ---: | :--- | | define | [**MY\_MACRO**](myheader_8h.md#define-my-macro) (A | B)<br>_Test macro._ |
Which shows:
Type | Name |
---|---|
define | MY_MACRO (A |
I could fix it locally by adding "|replace()" statements in member_template.py. I could do the same to fix newline being not replaced by <br>
by doxybook, causing the rest of the table being displayed in plain text after the table, which may happen when defining global variable.
Hi, I am developing a new plugin doxygen-snippets to easy generate documentation with Mkdocs. The plugin is based on this doxybook project. I hope, I have fixed many of the older bugs from this project. So, you could try my project, or fix your problem with add one line of code into doxybook:markdown.py -> ret = ret.replace('|', '\|')
Result:
def escape(s: str) -> str:
ret = s.replace('*', '\\*')
ret = ret.replace('_', '\\_')
ret = ret.replace('<', '<')
ret = ret.replace('>', '>')
ret = ret.replace('|', '\|')
return ret