docsifyjs / docsify

🃏 A magical documentation site generator.
https://docsify.js.org
MIT License
27.47k stars 5.67k forks source link

Reset .markdown-section max-width to 800px #2429

Closed cippaciong closed 2 months ago

cippaciong commented 4 months ago

Feature request

Reset .markdown-section max-width to 800px or a similar value

Problem or desire

Docsify used to limit articles max-width to 800px but this was changed to 80% in #1017, claiming that such value would look better on wider screens.

As already mentioned by @jhildenbiddle in a comment to that PR, I think this was a mistake since that would negatively affect the readability of the content.

IMO that change lead to two regressions:

Proposal

Restore .markdown-section max-width to 800px or a similar value.

Implementation

I'm not an expert, but I should manage to submit a PR if maintainers consider this change acceptable

jhildenbiddle commented 3 months ago

Thanks for filing the issue, @cippaciong.

TL;DR: We can address readability concerns and personal line-length preferences by doing the following:

  1. Set the default line length (or "measure") of the markdown area to a font-size relative value that strikes a balance between readability best practices (no more than 80 characters) and aesthetics. After doing a bit of research, this looks to be between 80-95 characters per line which results in a markdown container width of roughly 700px +/- 20px.
  2. Allow the markdown container's width to be configurable by site maintainers. This allows sites maintainers and theme authors using a different font to adjust the maximum width as needed to adhere to the "no more than 80 character" line length recommendation.

Details (for those who care)...

Some people will inevitably feel that the new markdown container width looks/feels too narrow. The criticism isn't necessarily wrong. All of the Docsify alternatives I tested have line lengths greater than 80 (see below). Every one of those alternatives also renders both left and right sidebars which help fill the horizontal space. Docsify, by comparison, will have a narrower overall content width which some people may not care for. There are a few additional things we can do to try and reduce (but not eliminate) these concerns:

For comparison, here are the default line length, font size, and content container width values from a few Docsify alternatives:

Finally, here are the line lengths using Docsify's vue.css theme and the previous max-width value of 800px:

Source Sans Pro (used in vue.css)

Based on these numbers, reverting the max-width to 800px (#1017) is not our best option. I think the best option is a font-relative max-width value that falls somewhere between 80-90 characters per line @ 16px.

paulhibbitts commented 3 months ago

Thanks @cippaciong for identifying this issue and @jhildenbiddle for the detailed analysis and possible options etc.

In addition to numerical line lengths I think we could consider a few other aspects as well. For example, many folks have grown accustomed to the information density of the current 80% of screen width currently in Docsify (and possibly manually adjust their Browser windows to their liking). In addition, with digital text there are also other aspects coming into play such as the need to scroll to read and how much scrolling is involved etc.

Here is a helpful article that highlights these additional aspects for reference: https://www.roboleary.net/webdev/2023/03/10/ideal-line-length-digital-text.html

I don't think there is an ideal answer to a revised Markdown section width for Docsify, and the current 80% of screen has a lot of readability issues. 800px width may not be ideal either, but given the display of digital text and related aspects, somewhere around there some good candidates might still exist.

jhildenbiddle commented 2 months ago

This issue has been addressed by PR #2469. The changes will be available when Docsify v5 is released.

Once v5 is release, this issue can be resolved by modifying the following theme property:

:root {
  --content-max-width: 72ch;
}