edwardtufte / tufte-css

Style your webpage like Edward Tufte’s handouts.
https://edwardtufte.github.io/tufte-css/
MIT License
5.99k stars 459 forks source link

TLC for Lists #118

Closed jez closed 7 years ago

jez commented 7 years ago

Fixes #117.

Commit Summary

There are three changes to this PR. They're broken down by commit:

Testing

You can apply this patch to index.html to get some tests cases for testing out lists (to make sure that there are no regressions).

Click to reveal patch ```diff diff --git a/index.html b/index.html index 1a1027b..c99df34 100644 --- a/index.html +++ b/index.html @@ -157,6 +157,99 @@

Epilogue

Many thanks go to Edward Tufte for leading the way with his work. It is only through his kind and careful editing that this project accomplishes what it does. All errors of implementation are of course mine.

+ +
+

Lists!

+

Simple lists (single line, no line wraps):

+
    +
  • A list item
  • +
  • Another item
  • +
  • One last item
  • +
+

Longer lists (not wrapped in paragraph tags):

+
    +
  • + Tufte CSS provides tools to style web articles using the ideas + demonstrated by Edward Tufte’s books and handouts. Tufte’s style is + known for its simplicity, extensive use of sidenotes, tight + integration of graphics with text, and carefully chosen + typography. + + + + Margin notes on lists line up at the same width as all other notes. + +
  • +
  • + Finally, a reminder about the goal of this project. The web is not + print. Webpages are not books. Therefore, the goal of Tufte CSS is + not to say “websites should look like this interpretation of + Tufte’s books” but rather “here are some techniques Tufte developed + that we’ve found useful in print; maybe you can find a way to make + them useful on the web”. Tufte CSS is merely a sketch of one way to + implement this particular set of ideas. It should be a starting + point, not a design goal, because any project should present their + information as best suits their particular circumstances. +
  • +
  • + Technical jargon, programming language terms, and code samples are + denoted with the code class, as I’ve been using in this + document to denote HTML. Code needs to be monospace for formatting + purposes and to aid in code analysis, but it must maintain its + readability. To those ends, Tufte CSS follows GitHub’s font + selection, which shifts gracefully along the monospace spectrum from + the elegant but rare Consolas all the way to good old reliable + Courier. +
  • +
+

Longer lists (1-2 paragraphs per list item):

+
    +
  • +

    + Tufte CSS provides tools to style web articles using the ideas + demonstrated by Edward Tufte’s books and handouts. Tufte’s style is + known for its simplicity, extensive use of sidenotes, tight + integration of graphics with text, and carefully chosen + typography. +

    +
  • +
  • +

    + Finally, a reminder about the goal of this project. The web is not + print. Webpages are not books. Therefore, the goal of Tufte CSS is + not to say “websites should look like this interpretation of + Tufte’s books” but rather “here are some techniques Tufte developed + that we’ve found useful in print; maybe you can find a way to make + them useful on the web”. + + + + Correct margin notes when list item has paragraph tag. + +

    +

    + Tufte CSS is merely a sketch of one way to + implement this particular set of ideas. It should be a starting + point, not a design goal, because any project should present their + information as best suits their particular circumstances. +

    +
  • +
  • +

    + Technical jargon, programming language terms, and code samples are + denoted with the code class, as I’ve been using in this + document to denote HTML. Code needs to be monospace for formatting + purposes and to aid in code analysis, but it must maintain its + readability. +

    +

    + To those ends, Tufte CSS follows GitHub’s font + selection, which shifts gracefully along the monospace spectrum from + the elegant but rare Consolas all the way to good old reliable + Courier. +

    +
  • +
```
daveliepmann commented 7 years ago

Thanks for putting in the work for a fix!

Could you post some specific before-and-after examples? (The example index.html document has, by default, no lists to test.)

jez commented 7 years ago

That's what the patch in the Testing section in the PR description is for. You can apply it to index.html on the gh-pages branch for the before, and on my jez-better-lists branch for the after.

Here are some screenshots doing just that:

Tighter lists by default

Tighter is good, because you can wrap in <p> tags to get looser lists.

Before
screen shot 2017-10-15 at 11 06 59 pm
After
screen shot 2017-10-15 at 11 07 18 pm

Correct line height if not wrapped in <p>

Sometimes you want tightly spaced lists that have longer entries. In these cases, you still want the line height to behave like it were a paragraph.

Also, we want to make sure that sidenotes and marginnotes show up at the same width as other notes in the page (that aren't attached to list items).

Before
screen shot 2017-10-15 at 11 07 52 pm
After
screen shot 2017-10-15 at 11 08 16 pm

Correct width if list item contents are wrapped in paragraphs

Sometimes you want multiple paragraphs in a single list item (or even just one paragraph per list item, to get more loosely spaced lists).

Before, the width: 55% was cascading to the inner <p>, when we really only want the top-level <p> tag to be width: 55%.

Before
screen shot 2017-10-15 at 11 08 37 pm
After
screen shot 2017-10-15 at 11 08 57 pm
daveliepmann commented 7 years ago

Sorry about the delay on this. It will be a little longer before I have time to fully test, merge, and update the version. Please sit tight. :)

daveliepmann commented 7 years ago

Note to self: I must release a new version, mostly for this change, but also to include minor stuff from other recent PRs.

daveliepmann commented 6 years ago

Hey, thanks again for this well-thought-out, well-documented PR. I just (finally!) included it in a fresh release, v1.4.