gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

maintenance(docs): Prevent use of h1s in markdown #23662

Closed tesseralis closed 4 years ago

tesseralis commented 4 years ago

Description

Add the rule remark-lint-first-heading-level and prevent the use of h1s in markdown.

Motivation

A page should only one <h1> tag. In Gatsby, this is the title of the document in the frontmatter, so it is incorrect formatting to include another in the body of the document.

Steps

  1. yarn add remark-lint-first-heading-level
  2. Add the line ["remark-lint-first-heading-level", 2] to our .remarkrc
  3. Run yarn lint:docs and fix the errors

Related Issues

23660 is another issue regarding remark lint headings and may need to be worked on in concert with this one.

ubmit commented 4 years ago

Hey there! I'd be glad to help with this!

tesseralis commented 4 years ago

@guilhermedeandrade sure! thanks for the help.

ubmit commented 4 years ago

@tesseralis you're welcome! I have a question about situations like this one here:

#### Pros

- Free
- No ads
- No third party scripts injected into your site
- Complete control over functionality and design
- Can be as simple or complicated as you want
- Little to no spam because spambots aren't set up to spam your custom content
- Easy to migrate - it all exists in one Heroku + Postgres server

#### Cons

- More work to set up
- Less features
- Need to set up manual anti-spam measures and moderation

Even though the lint error will go away just by changing #### Pros to ## Pros, it feels strange because there is the "Cons" section right after which would be an h4. What should we do in those cases?

PS.: this example is from the docs/blog/2019-08-27-roll-your-own-comment-system/index.mdfile

ubmit commented 4 years ago

Another similar example from docs/docs/recipes/gitlab-continuous-integration.md:

### Prerequisites

- Make sure you have the [Gatsby CLI](/docs/gatsby-cli) installed
- A [Gitlab](https://gitlab.com/) account

### Directions

1. Create a gatsby site
[...]
tesseralis commented 4 years ago

@guilhermedeandrade Both of the headings should be changed. In general, if one heading is changed, all the headings of the same level should change as well.

ubmit commented 4 years ago

Ok, thanks for the info! I will double check the files I have changed

ubmit commented 4 years ago

@tesseralis I adjusted the files considering your last comment and here is the PR: https://github.com/gatsbyjs/gatsby/pull/23664