Skip to content
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

Improve handling of unknown elements #13911

Open
coryan opened this issue Apr 3, 2024 · 0 comments
Open

Improve handling of unknown elements #13911

coryan opened this issue Apr 3, 2024 · 0 comments
Labels
cpp: docfx Improvements for the DocFX tool type: cleanup An internal cleanup or hygiene concern.

Comments

@coryan
Copy link
Member

coryan commented Apr 3, 2024

When I implemented the docfx tool I skipped handling of most elements in a <para>. There are about 300 of them:

https://github.com/doxygen/doxygen/blob/2717489cb90ffd338217b6ce6d2fcb38f25495e6/src/htmlentity.cpp#L40

And we only use about a dozen:

bool AppendIfDocTitleCmdGroup(std::ostream& os, MarkdownContext const& ctx,
pugi::xml_node node) {
if (AppendIfPlainText(os, ctx, node)) return true;
if (AppendIfULink(os, ctx, node)) return true;
if (AppendIfBold(os, ctx, node)) return true;
// Unexpected: s
if (AppendIfStrike(os, ctx, node)) return true;
// Unexpected: underline
if (AppendIfEmphasis(os, ctx, node)) return true;
if (AppendIfComputerOutput(os, ctx, node)) return true;
// Unexpected: subscript, superscript, center, small, del, ins
// Unexpected: htmlonly, manonly, rtfonly, latexonly, docbookonly
// Unexpected: image, dot, msc, plantuml
if (AppendIfAnchor(os, ctx, node)) return true;
// Unexpected: formula
if (AppendIfRef(os, ctx, node)) return true;
// Unexpected: emoji
if (AppendIfLinebreak(os, ctx, node)) return true;
// Unexpected: nonbreakablespace
// Unexpected: many many symbols
if (AppendIfNDash(os, ctx, node)) return true;
return false;

The docfx tool intentionally crashes when it finds an element it does not know how to handle. That way we can update the code when needed. But maybe we should proactively add elements that we think may appear in the future and are safe to handle.

@coryan coryan added type: cleanup An internal cleanup or hygiene concern. cpp: docfx Improvements for the DocFX tool labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp: docfx Improvements for the DocFX tool type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

1 participant