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

Superfluous wrapper divs in generated pages affects css #4524

Closed
broxen opened this issue Sep 30, 2021 · 1 comment · Fixed by #4528
Closed

Superfluous wrapper divs in generated pages affects css #4524

broxen opened this issue Sep 30, 2021 · 1 comment · Fixed by #4528

Comments

@broxen
Copy link
Contributor

broxen commented Sep 30, 2021

I'm seeing superfluous empty wrapper divs in my wiki pages. This creates some issues when trying to stylize the first-child or next element using css

Source:

## Extra Divs
Test Paragraph here. [link](#)
- list
- list

Generated:

<h2 id="extra-divs" class="toc-header"><a href="#extra-divs" class="toc-anchor"></a> Extra Divs</h2>
<div></div>
<p>Test Paragraph here. <a href="#">link</a></p>
<div></div>
<ul>
  <li>list</li>
  <li>list</li>
</ul>
<div></div>

Seems like this section of code is adding divs around hardlines and blank space. I don't see any other utility for this section of code, can it be safely removed?
https://github.com/Requarks/wiki/blob/a20f70ed8de1e5b2e216f6d87b4f8da97019dd56/server/modules/rendering/html-core/renderer.js#L239-L243

broxen added a commit to broxen/wiki that referenced this issue Oct 1, 2021
It seems like standalone text is already wrapped in paragraph elements, so this code seems superfluous. Additionally, it adds div wrappers at every line break as described in requarks#4524
@NGPixel
Copy link
Member

NGPixel commented Oct 2, 2021

See my reply in your PR.

@NGPixel NGPixel closed this as completed Oct 2, 2021
NGPixel added a commit that referenced this issue Oct 9, 2021
* Removing superfluous div wrapping

It seems like standalone text is already wrapped in paragraph elements, so this code seems superfluous. Additionally, it adds div wrappers at every line break as described in #4524

* Fix for newlines and returns

This change skips newlines and returns to focus on unbounded text only.

* misc: fix indentation

* misc: fix indentation (2)

Co-authored-by: Nicolas Giard <github@ngpixel.com>
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 a pull request may close this issue.

2 participants