Skip to content

Fix dash rendering #1024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix dash rendering #1024

wants to merge 2 commits into from

Conversation

prosilio
Copy link

@prosilio prosilio commented Mar 16, 2025

closes #963

PR #759 replaces ndash/ and mdash/ tags with Unicode —, which is not being rendered properly:

image

Instead, I replace ndash/ and mdash/ with -- and ---, respectively, which are rendered properly in my tests.

Here are some examples:

Text - with - hyphens

Text -- with -- endashes

Text --- with --- emdashes

image

> This is a block quote with en-dash (two hyphens) attribution.
>
> -- Anonymous

image

> This is a block quote with em-dash (three hyphens) attribution.
>
> --- Anonymous

image

> This is a block quote with lots of hyphens in the attribution.
>
> -------------- Anonymous

image

> -- This is a block quote with en-dashes in the quotation --
>
> -- Anonymous

image

> -- Dashes -- --- everywhere! ---
>
> -- Here -- --- too! ---
>
> -- --- --Anonymous ---

image

PR breathe-doc#759 replaces en-dashes and em-dashes with Unicode `—`, which
is not being rendered properly. Instead, I replace ndash/ and mdash/
tags with `--` and `---`, respectively, which are rendered properly in
my tests.
@sethrj
Copy link

sethrj commented May 17, 2025

I really appreciate this fix! Grepping my sphinx html output for &# I see this in about 7 places in my project's user manual. Could one of the maintainers (@michaeljones perhaps ?) please take a look at this PR? Thanks for your hard work and great product!

@michaeljones
Copy link
Collaborator

Hi, thank you for the PR and for attempting to resolve the issue. Unfortunately we have a long standing PR which is going to remove the file that you have changed (breathe/parser/compound.py). We can look at the new approach and see how it handles the ndash and mdash nodes and try to ensure good behaviour. We are hopefully close to doing a alpha release of v5 with the new approach and we can test from there.

As for the attribution handling, I'm not sure that Breathe should be doing things like that? We aim to translate doxygen supported syntax into restructured text nodes and so if there isn't support for the dash in the attribution handling in doxygen then maybe we shouldn't support it here? Otherwise it feels like we're creating a Breathe flavoured markdown or doxygen markup which seems less than ideal? Unless I am getting confused? I'd be happy to hear your thoughts though if you have the time and energy to re-engage at this point.

@sethrj
Copy link

sethrj commented Jul 2, 2025

Perhaps we just need to make sure that HTML escapes (into XML) are converted into unicode characters?

@prosilio
Copy link
Author

prosilio commented Jul 7, 2025

Thank you for the comments, @michaeljones. I'm familiar with the long-standing PR you referenced, and I had been wondering if it would obviate this PR. Looking forward to the v5 alpha release! If you want, we can close this PR and wait and see what v5 brings.

My reason for including so many attribution examples is that the intent of PR #759 was to support block quotes, so I wanted to ensure that my changes didn't break the changes from that PR.

And thank you for your enthusiasm, @sethrj! It's nice to know that my work helps someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

En-dash in @return renders incorrectly
3 participants