-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-doc] remove indentation for preformatted text #166672
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesText that is in between Full diff: https://github.com/llvm/llvm-project/pull/166672.diff 2 Files Affected:
diff --git a/clang-tools-extra/clang-doc/assets/class-template.mustache b/clang-tools-extra/clang-doc/assets/class-template.mustache
index b1a7470f7c33a..04f24e12374b2 100644
--- a/clang-tools-extra/clang-doc/assets/class-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/class-template.mustache
@@ -142,7 +142,7 @@
{{#PublicMembers}}
<div id="{{Name}}" class="delimiter-container">
<pre>
- <code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code>
+<code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code>
</pre>
{{#MemberComments}}
<div>
diff --git a/clang-tools-extra/clang-doc/assets/namespace-template.mustache b/clang-tools-extra/clang-doc/assets/namespace-template.mustache
index d96bc5ce91f3a..d5836dcefbfc2 100644
--- a/clang-tools-extra/clang-doc/assets/namespace-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/namespace-template.mustache
@@ -93,7 +93,7 @@
<li id="{{USR}}" style="max-height: 40px;">
<a href="{{DocumentationFileName}}.html">
<pre>
- <code class="language-cpp code-clang-doc">class {{Name}}</code>
+<code class="language-cpp code-clang-doc">class {{Name}}</code>
</pre>
</a>
</li>
|
|
See https://erickvelez.com/clang-doc-mustache-output/pr166672/ for display diff. The doc entities in the namespace page are no longer indented. |
What am I supposed to be looking at that is wrong? Are you saying there is extra indentation? The page looks OK to me. Or is that an example where its fixed? do you have an example where its wrong in that case? |
It's fixed in the first link. See this link where you can see the indentation for all the classes in the global namespace. https://erickvelez.com/clang-doc-mustache-output/pr164314/ If you go to a class, you'll also see that it's fixed for public members. |
|
I guess that makes me wonder if we want a Locally If I edit the HTML in DevTools, and remove those tags, it looks as expected. WDYT about that? I think its preferable to keep the template looking sane if we can. Alternatively, we could tightly wrap the WDYT? |
We need https://github.com/highlightjs/highlight.js?tab=readme-ov-file#in-the-browser If want it done a different way, without needing the https://github.com/highlightjs/highlight.js?tab=readme-ov-file#using-custom-html But I think the |
|
We can try just putting them on one line, |
I think this probably makes sense for top level entities, like these type identifiers for the class and namespace.
The custom route is something I'd prefer to avoid if we can. It introduces a lot of complexity and extra JS to manage.
For general code blocks, sure, but I'm not sure how much we rely on it for formatting the top level identifiers, like what's in this patch. I guess, maybe its always fine to just wrap them "tightly" on a single line? I can't seem to think of a scenario where I'd expect that to do the wrong thing. Though, I'll admit I haven't thought of it too much, and I really need to see/play with concrete HTML to understand it personally. |
It's true, for the top level entities all it does is highlight the tag keyword ( |
|
Well, I think I'm fine w/ just always using the tight wrapping on If that looks OK to you, and the output looks as intended, lets just go w/ that, since its the minimal change I can think of |
8efcd30 to
9cfef46
Compare
Text that is in between <pre> tags is formatted verbatim. Thus, the text that was correctly indented in relation to its depth in HTML was being indented incorrectly when rendered. That resulted in bad looking pages.
9cfef46 to
7bbed06
Compare
Text that is in between `<pre>` tags is formatted verbatim. Thus, the text that was correctly indented in relation to its depth in HTML was being indented incorrectly when rendered. That resulted in bad looking pages.

Text that is in between
<pre>tags is formatted verbatim. Thus, thetext that was correctly indented in relation to its depth in HTML was
being indented incorrectly when rendered. That resulted in bad looking pages.