mamatt / files_readmemd

Show README.md & HEADER.md in the file view of NextCloud
GNU Affero General Public License v3.0
13 stars 5 forks source link

Automatically generated ID of headers might collide with NextCloud styling rules. #106

Closed RobertZenz closed 4 months ago

RobertZenz commented 1 year ago

For example if you have the following README.md file:

Content
-------

Content goes here.

That will generate the following HTML (roughly):

<div id="app-content-readmeMD" class="markdown-body readmemd no-before" data-filename="README.md">
<h2 id="content" tabindex="-1">Content</h2>
<p>Test</p>
</div>

Unfortunately some NextCloud styling rules are not that, uh, exact, which means that it will pick up the #content and apply non-fitting styles to the header element, resulting in a broken layout.

Whether that is NextClouds fault or not is a hard question (I'm not that happy with NextCloud anyway, so...), but are these IDs used? Maybe not creating them would be a solution. They could be used as jumpmarks in the URL, but my tests show that that is broken anyway, currently, on directly navigating to the site nothing happens.

RobertZenz commented 1 year ago

Maybe a solution would be to embed the displayed content in an iframe, I believe that should stop CSS styles from propagating to it. But that will also stop all CSS styles from propagating to it.

mamatt commented 1 year ago

I'll check in detail, but I think this is added by the markdown lib used to render to md file

mamatt commented 1 year ago

the problem seems to be located in the toc-anchor plugins.