Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add markdown linting and fix errors #1091

Merged
merged 10 commits into from
Aug 26, 2020
Merged

feat: add markdown linting and fix errors #1091

merged 10 commits into from
Aug 26, 2020

Conversation

olizilla
Copy link
Collaborator

@olizilla olizilla commented Aug 25, 2020

Adds remark-lint as a fancy and configurable markdown linter that we can tweak to help us write better specs.

I have fixed markdown errors as I've added rules, including multiple broken links and missing code blocks. The current output of the linter is clean on this branch, and I've enabled it in CI.

Run npm test to try it out. Example output:

⨎ npm test

> specs-new@1.0.0 test /Users/oli/Code/filecoin-project/specs
> remark content --quiet

content/algorithms/crypto/randomness.md
  15:39-15:46  warning  Found reference to undefined definition  no-undefined-references  remark-lint
  54:24-54:31  warning  Found reference to undefined definition  no-undefined-references  remark-lint

⚠ 2 warnings

License: MIT
Signed-off-by: Oli Evans oli@tableflip.io

@olizilla
Copy link
Collaborator Author

added a rule to warn when headings increment more than 1 level at a time.

⨎ npm test

> specs-new@1.0.0 test /Users/oli/Code/filecoin-project/specs
> remark content --quiet

content/algorithms/porep/stacked_drg_circuit.md
  10:1-10:25  warning  Heading levels should increment by one level at a time  heading-increment  remark-lint

content/libraries/drand/_index.md
  25:1-25:29  warning  Heading levels should increment by one level at a time  heading-increment  remark-lint

⚠ 2 warnings

@olizilla
Copy link
Collaborator Author

ok this is starting to feel nice...

added a rule to warn when code fences do not have a language flag

⨎ npm test

> specs-new@1.0.0 test /Users/oli/Code/filecoin-project/specs
> remark content --quiet

content/algorithms/crypto/signatures.md
    64:1-66:4  warning  Missing code language flag  fenced-code-flag  remark-lint

content/algorithms/porep/stacked_drg.md
  255:1-257:4  warning  Missing code language flag  fenced-code-flag  remark-lint
  260:1-262:4  warning  Missing code language flag  fenced-code-flag  remark-lint

content/algorithms/post/election_post.md
  213:1-221:4  warning  Missing code language flag  fenced-code-flag  remark-lint

content/libraries/drand/_index.md
    29:1-35:4  warning  Missing code language flag  fenced-code-flag  remark-lint

⚠ 5 warnings

@olizilla olizilla added this to In progress in beta.spec.filecoin.io via automation Aug 25, 2020
@olizilla
Copy link
Collaborator Author

Added rule to ensure all docs start with an h1

⨎ npm test

> specs-new@1.0.0 test /Users/oli/Code/filecoin-project/specs
> remark content --quiet

content/implementations/lotus.md
  17:1-17:9  warning  First heading level should be `1`  first-heading-level  remark-lint

⚠ 1 warning

@olizilla
Copy link
Collaborator Author

made a custom lint rule to warn aginst our pattern of putting a horizontal rule after a heading... to fix #1081

see: https://github.com/olizilla/remark-lint-no-hr-after-heading

content/systems/filecoin_vm/sysactors/cron_actor.md
     11:1-11:4  warning  Don’t use a horizontal line after a heading  no-hr-after-heading            remark-lint

content/systems/filecoin_vm/sysactors/init_actor.md
     11:1-11:4  warning  Don’t use a horizontal line after a heading  no-hr-after-heading            remark-lint

content/systems/filecoin_vm/sysactors/reward_actor.md
     10:1-10:4  warning  Don’t use a horizontal line after a heading  no-hr-after-heading            remark-lint

⚠ 138 warnings

@olizilla olizilla marked this pull request as ready for review August 25, 2020 15:06
plugins:
# make remark aware of fontmatter.
remark-frontmatter:
# sensible linter defaults see: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended#rules
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we configure what markdown linting rules we want. we start with a preset with a bunch of rules enabled, then add some of our own, then remove some of the preset rules that were too noisey

@@ -31,8 +27,6 @@ This circuit proves that given a Merkle root `CommD`, `CommRLast`, and `commRSta
- otherwise, execute the function
- **Inclusion path**: Binary representation of the Merkle tree path that must be proven packed into a single `Fr` element.

# Offline PoRep circuit
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bring this back says @hugomrdias

hugomrdias
hugomrdias previously approved these changes Aug 25, 2020
@olizilla
Copy link
Collaborator Author

@hugomrdias fixed merge conflict and the drg header nesting, and added a note about npm test markdown linting to the readme.

Good to merge?

@olizilla olizilla added the hint: beta Hint: Issues related to the beta branch label Aug 26, 2020
hugomrdias
hugomrdias previously approved these changes Aug 26, 2020
adds remark-lint as a fancy and configurable markdown lintert that we can tweak to help us write better specs.

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
adds remark-lint-heading-increment to warn when headings increment with more than 1 level at a time.

see: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-heading-increment

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
adds remark-lint-fenced-code-flag to ensure code fences have a language flag

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
adds remark-lint-first-heading-level - warn when the first heading has a level other than 1

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
Adding horizontal rules under headings leads to inconisistent heading levels getting underlined, as we re-write the headings based on depth in the tree.

We can underline h1/h2s with css if required.

fixes #1081

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
@hugomrdias hugomrdias merged commit 0db2e08 into beta Aug 26, 2020
beta.spec.filecoin.io automation moved this from In progress to Done Aug 26, 2020
@hugomrdias hugomrdias deleted the remark-lint branch August 26, 2020 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hint: beta Hint: Issues related to the beta branch
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants