Consider these two examples:
Thanks for reporting.
Strange, both pages look fine to me. You don't have a text/gemini entry in ~/.mailcap, right?
Also, what does this print?
$ printf '=> about:blank test\n=> about:blank test\n' | cha -dT text/gemini
I found the culprit, it's
buffer.styling
, when set totrue
everything looks fine, and your test returns two lines (and when set tofalse
, it's one line, 'testtest').As a workaround, it can be toggled with a siteconf option, of course. But in general, unless I'm very wrong, Gemini sites don't really have styles, and
buffer.styling
probably shouldn't apply to them?
~skejg wrote:
I found the culprit, it's
buffer.styling
, when set totrue
everything looks fine, and your test returns two lines (and when set tofalse
, it's one line, 'testtest').As a workaround, it can be toggled with a siteconf option, of course. But in general, unless I'm very wrong, Gemini sites don't really have styles, and
buffer.styling
probably shouldn't apply to them?Oh.
Well, intuitively they don't have styles. But in the background, gemtext gets converted to HTML, and then
<body>
getswhite-space: pre-line
to match the spec-mandated formatting style.That does make
styling
as a global parameter somewhat unusable. Maybe it shouldn't affect x-htmloutput's inline styles at all?Or, better: we could add a mailcap extension field like x-needsstyle and set it only on formats that output built-in styles, so that
styling
can still affect HTML dialects like Markdown where author styles exist.
Or, better: we could add a mailcap extension field like x-needsstyle and set it only on formats that output built-in styles, so that styling can still affect HTML dialects like Markdown where author styles exist.
That would require a user to learn and do something new and non-standard about the mailcap, or am I mistaken? My point is, people rarely read the documentation in general -- and especially about the things they think they already know and use :)
I personally would just put a guard in the code to ignore certain configuration values on certain occasions. But maybe it's a bad practice or would have some caveats...
Or, better: we could add a mailcap extension field like x-needsstyle and set it only on formats that output built-in styles, so that styling can still affect HTML dialects like Markdown where author styles exist.
That would require a user to learn and do something new and non-standard about the mailcap, or am I mistaken?
No, res/mailcap includes the default gemtext entry, and x-needsstyle would be added there. So in your case you wouldn't have to do anything.
Users would have to learn about x-needsstyle only if they set
styling=false
and added a custom x-htmloutput mailcap entry and wished to use CSS in that entry. Probably not too much of a burden to read the docs at that point :PI personally would just put a guard in the code to ignore certain configuration values on certain occasions. But maybe it's a bad practice or would have some caveats...
If you mean "just ignore the
styling
option on x-htmloutput", the caveat is that this is valid markdown (or at least accepted as such):<style>p { text-decoration: blink }</style> blink
and then it would blink even with
styling=false
, since md2html also uses x-htmloutput. Same thing applies for e.g. user-defined xhtml or epub x-htmloutput entries.
Users would have to learn about x-needsstyle only if they set styling=false and added a custom x-htmloutput mailcap entry and wished to use CSS in that entry. Probably not too much of a burden to read the docs at that point :P
Agreed, that sounds reasonable (both the scheme and the docs reading condition :)
If you mean "just ignore the styling option on x-htmloutput"
I thought more about "just ignore this option for this protocol". But your proposed solution above seems like a way better approach.
OK, should be fixed now.
Can confirm, works for me.
Thanks!
Thanks for confirming.
Well.... That's not all, it seems :)
I have a cgi script, which wraps the current html page in a table, adding left and right columns to narrow down the reading area. Basically it curls a page and pipes it to awk:
awk ' BEGIN{ print "Content-type: text/html\n\n" } /<body/{ sub(/<body[^>]*>/, "<body><table><tbody><tr><td width=\"20%\"></td><td>") } /<\/body>/{ sub(/<\/body>/, "</td><td width=\"20%\"></td></tr></tbody></table></body>") } { print }'
With the commit a68e17b7 (and
buffer.styling
disabled), it's now broken. Settingbuffer.styling
totrue
makes it work. Except there's no style here, I'd say :)
Right, that was not intended. Should be fixed now, thanks for reporting.
And thanks again for fixing, everything looks OK now :)