Hacker News new | ask | show | jobs
by 3pt14159 2121 days ago
Exactly. Also this:

> Avoid skipping heading levels: always start from <h1>, next use <h2>, and so on.

Isn't quite correct. For longer documents it is sometimes appropriate to skip a level if it is warranted. For example, an online book may have an <h1> for a chapter heading, then some text introducing the chapter, then a minor point that doesn't deserve as much prominence as a proceeding section. So under a chapter called "Introducing Python" (an <h1>) there may be a heading immediately following the <p> text after the <h1> called "Python Runtimes" that isn't really an important part of the document, but deserves to be covered before any <h2> is called. It's ok to label it <h3> so that it shows up in the table of contents appropriately as a minor section.

It also makes more semantic sense and is better for screen readers too. If "Python Runtimes" were a <h2> a reader / lister could reasonably assume that this is a semi-major part of "Introducing Python" when it is not. It's just a quick interlude that says "There are many types of python, you should probably use CPython, since that is what this book is going to assume" or something like that.

But like you say, this is geared towards junior devs, so it's ok to generalize a bit.