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

Improved detection of the lede paragraph for styling purposes #256

Open
kazarena opened this issue Apr 26, 2021 · 4 comments
Open

Improved detection of the lede paragraph for styling purposes #256

kazarena opened this issue Apr 26, 2021 · 4 comments
Labels
enhancement New feature or request suggestion Suggestion for future consideration

Comments

@kazarena
Copy link

@skyjake, thank you for creating the most awesome browser! I use it every day now.

Problem

Prior to version 1.3.0, Lagrange had a very nice feature: the first plain-text paragraph was emphasised with a larger font. I found it to be a great visual aid. I believe the feature is still there, but it doesn't always get triggered. For example, when there is a pre-formatted block at the beginning of the page, it doesn't appear.

Or maybe it's designed to work this way?

Examples

  • gemini://gemini.circumlunar.space/docs/gemtext.gmi - works as expected (no pre-formatted header)
  • gemini://konpeito.media/ - doesn't work on first load. If I click on the pre-formatted header to collapse it, the first line gets emphasised as expected

My environment

  • MacOS 10.15.7
  • Lagrange 1.3.4 (I noticed the issue in 1.3.0)
  • Lagrange installed with homebrew
@skyjake
Copy link
Owner

skyjake commented Apr 27, 2021

Or maybe it's designed to work this way?

Yes, this is intended behavior. There is a heuristic for applying the effect: if there is content before what is considered the lede paragraph, the big font is not applied.

There is probably room for tuning the heuristic, but I feel it is necessary to have it or otherwise many pages will get the effect inappropriately.

In the specific case on Konpeito, the effect shouldn't be applied in any case because the site uses hard-wrapped lines and that would only make the first line of the (apparent) paragraph have a larger font. Hard-wrapped lines should actually be added to the heuristic...

@skyjake skyjake added enhancement New feature or request suggestion Suggestion for future consideration labels Apr 27, 2021
@skyjake skyjake changed the title Inconsistent styling of the first paragraph Improved detection of the lede paragraph for styling purposes Apr 27, 2021
@kazarena
Copy link
Author

@skyjake, thank you for the explanation. I'm happy with the proposed strategy.

In the specific case on Konpeito, the effect shouldn't be applied in any case because the site uses hard-wrapped lines...

I noticed the behaviour above with my own site (without hard-wrapped lines), that collapsing the pre-formatted header would affect the rendering of the first paragraph. Speaking of the heuristic, I wonder if pre-formatted blocks should be treated more like an image in a traditional sense (as we can't apply format to it) rather than text, and therefore ignored by the heuristic? In the majority of cases so far, the pre-formatted block in the beginning of the page would be ascii art, so it confirms this line of thinking.

@burakozhan
Copy link

I'll want to add in on this issue.
This is the rendering

image

For this code

# Title 1
# Title 2
Line one.
Line two.

In this case there have been titles before the first line. The line reading "Line one." is clearly not a lede anymore.

I understand that this behaviour can be turned off by the user of the client, somewhere in the settings.
What I would be interested more; is there a way for me as the capsule owner to disable this "larger font on first line" behaviour? It totally breaks my page layout. Can I put a config file in the same document root that is read by lagrange with lede=disabled or something?

Besides that, thank you @skyjake for lagrange. It essentially is the only gemini browser that handles my idn domain name properly.

@skyjake
Copy link
Owner

skyjake commented Feb 16, 2024

The line reading "Line one." is clearly not a lede anymore.

Well, I would say that's still context-dependent. One could have any number of heading lines preceding the actual lede paragraph of the page. The automatic detection is just going to fail in some cases.

is there a way for me as the capsule owner to disable this "larger font on first line" behaviour?

Unfortunately no. The Gemini protocol has no mechanism for the capsule owner to specify this kind of markup that would influence how clients present the content.

Could you give me the URL of the page that you feel is being improperly presented? I can always tweak the detection algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request suggestion Suggestion for future consideration
Projects
None yet
Development

No branches or pull requests

3 participants