Skip to content

Consistent Markdown Linting between Content Editors and Engineers #7781

@caseywatts

Description

@caseywatts

This is related to #4601

This is an idea to improve the documentation around linting.

Is your feature request related to a problem? Please describe.
In my project, we have linting enabled so when developers edit the markdown files, they get formatted consistently. For a year now we've been formatting using prettier, but that conflicts with the formatting that the Decap Markdown editor widget uses, remark. When a content editor edits a file using Decap and then a developer edits a file with their text editor (via GitHub directly), that causes "thrashing" where their styles don't agree.

Describe the solution you'd like
We could describe a suggested configuration for folks to use to set up linting, to match between Decap and GitHub.

Describe alternatives you've considered

Additional context
I wanted to share some other formatting tips, and this issue is the most related one:

We now run remark in our CI flow too, so developer changes to markdown files get linted in exactly the same way!

To get this to work, we added these two npm packages:

We had to include remark-frontmatter because our linting does the entire file. Decap's markdown editor widget only edits the "body" -- it doesn't have to be aware of frontmatter, that's why Decap doesn't have this additional dependency.

We run these the same way we run our other linters (this part I don't think we have to document, I'm just sharing):

  1. in our CI
  2. in our text editors
  3. as a pre-commit hook

In our documentation, we could also say that we don't have to specify any configuration settings here. I originally was following the remark setup guide, and that suggested explicitly using their default formatting plugins -- but that was not necessary (and may have ended up in having our configuration diverge again between Decap and GitHub.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurecode contributing to the implementation of a feature and/or user facing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions