xiota / geany-preview

Turns Geany into a markdown editor by providing a preview pane in the sidebar to show the formatting of several light-weight languages as they are edited. Supported document types include AsciiDoc, DocBook, Fountain, HTML, LaTeX, Markdown, MediaWiki, reStructuredText, Textile, and Txt2Tags.
GNU General Public License v3.0
12 stars 0 forks source link

the preview of long txt-documents does not respect the background color of extra_css for some snippets #22

Closed ralf3u closed 2 years ago

ralf3u commented 2 years ago

I made tests with extra_css=extra-media.css and with extra_css=disable. Some snippets have the background color #808080, sometimes the first snippet, or sometimes not the first snippet but the second, third or fourth snippet. I have no idea where the color comes from.

xiota commented 2 years ago

CSS is supposed to apply the most specific rule. If multiple rules match, it's supposed to use the rule that was defined last.

extra_css is added to the webview early. So whatever CSS is defined in the document is given priority.

So with the first few snippets, the document stylesheet can override extra_css. For later snippets, the document stylesheet is cut off and extra_css rules take over.

Ideally, stylesheets from the document would be preserved for all snippets. But I don't know a good way to do that because HTML is variable. Trying to do too much processing can break things (as has happened before) and affect performance.

ralf3u commented 2 years ago

@xiota To your last comment: I think that there is a misunderstanding. The title of this issue is "txt-documents" and not html-documents. I don't use stylesheet for txt-documents. And I use in all documents nowhere the color #808080. And it is

.... sometimes not the first snippet but the second, third or fourth snippet.

xiota commented 2 years ago

What filetype is the txt document being interpreted as?

ralf3u commented 2 years ago

What filetype is the txt document being interpreted as?

How can I know this? Maybe this could help: I use the default settings of preview.conf, so I didn't change preview.conf.

xiota commented 2 years ago

Plain documents don't have internal CSS to cut off, so I don't know why snippets would change anything.

The fountain.css has #707070. preview.css uses "lightgray", but it applies only to the "geany_preview_headers" class.

I'd need to see an example of one of the problem files.

ralf3u commented 2 years ago

Do you know of a file with this problem that I can download from somewhere?

The used document has personal content. I tried a txt-document with 40x "lorem ipsum..." as content, but I can't reproduce the issue. It is only that special document. In the editor in the tab-title there is txt as format. When I rename the document, then the issue is still there. I will try in the next days to reproduce the issue with an other document.

The fountain.css has #707070. preview.css uses "lightgray"

The color of lightgray is #d3d3d3. Are you sure that #808080 is not being used somewhere?

xiota commented 2 years ago

It is only that special document.

Let me know when you find an example that reproduces the problem.

Are you sure that #808080 is not being used somewhere?

You can look at the CSS files in the config folder to see if you find anything.

ralf3u commented 2 years ago

You can look at the CSS files in the config folder to see if you find anything.

I couldn't find anything. The color #808080 is gray or RGB (128, 128, 128).

xiota commented 2 years ago

I couldn't find anything.

I don't know where the color would be from either.

ralf3u commented 2 years ago

I found the cause. Somewhere in the txt-document there was one single line of html:

<body style="background:gray">

I erased the line and the issue was solved. As consequence of this issue I just opened a new issue, issue number 24.