liran-funaro / sphinx-markdown-builder

A Sphinx extension to add markdown generation support.
https://pypi.org/project/sphinx-markdown-builder
MIT License
41 stars 19 forks source link

[BUG] Extra <br/> added for every line #17

Open revati-naik opened 8 months ago

revati-naik commented 8 months ago

Describe the bug A clear and concise description of what the bug is. The markdown file generated has multiple
entries that cause multiple new rows to be added.

I am using this extension along with sphinx and sphinx-needs

To Reproduce Steps to reproduce the behavior:

  1. Clone '...'
  2. Install packages '....'
  3. Run '....'
  4. See error

This is how the markdown file entry looks like


| Software Requirement: **The package shall detect dropped messages.** [SWRQ_SYSTEM_MONITOR_422](#SWRQ_SYSTEM_MONITOR_422)<br/><br/>                                                                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| integrity: ASIL-D<br/><br/><br/>has_dead_links: True<br/><br/><br/>has_forbidden_dead_links: True<br/><br/><br/><br/><br/>links outgoing: OUT_1<br/><br/><br/><br/> |
| Some text message.                                                        |

Expected behavior A clear and concise description of what you expected to happen. I am not sure what this should look like. But when converting the above markdown to HTML using mkdocs, it comes up funny. Like a lot of rows/spaces added.

Could we have this fixed?

Environment (please complete the following information):

Additional context Add any other context about the problem here.

revati-naik commented 8 months ago

I could fix it partly by changing

replace("\n", "<br/>")

With

replace("\n", "")

on line https://github.com/liran-funaro/sphinx-markdown-builder/blob/09eff5b058455c14a6cd3fa8f16ba2e2550669ae/sphinx_markdown_builder/contexts.py#L273

liran-funaro commented 8 months ago

Hi @revati-naik. Please try to create a minimalistic example to reproduce this issue.

revati-naik commented 8 months ago

Hi, Please find the below versions to be included in the reproduction of this bug

Describe the bug

When writing a .rst file,

.. swrq:: The package package shall detect dropped messages.
    :id: SWRQ_SYSTEM_MONITOR_422
    :integrity: ASIL-D
    :links: LINK_!, LINK2

   Description of the above requirement

When using the sphinx markdown builder, I see an output as below


| Software Requirement: **The package shall detect dropped messages.** [SWRQ_SYSTEM_MONITOR_422](#SWRQ_SYSTEM_MONITOR_422)<br/><br/>                                                                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| integrity: ASIL-D<br/><br/><br/>has_dead_links: True<br/><br/><br/>has_forbidden_dead_links: True<br/><br/><br/><br/><br/>links outgoing: OUT_1<br/><br/><br/><br/> |
| Some text message.                                                        |

This has multiple instances of <br/> inserted.

This causes issues later on for markdown parsers. On making the change as mentioned above, I was able to get rid of a few <br/> but not all. So my table rows have a lot of spacing in them when I render in HTML using mkdocs. Also, there are multiple blank rows.

To Reproduce Steps to reproduce the behavior:

Create an rst file like above Convert it to markdown with this plugin See similar output in markdown Expected behavior

One `
anchor should be enough per new row.

Environment (please complete the following information):

OS: Ubuntu Version: 22.04 Additional context Add any other context about the problem here.

liran-funaro commented 3 months ago

This is the intended behaviour. I don't see any issue with this. Can you provide the HTML output of that same document for reference?