-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
fix: MD046/code-block-style #2557
Conversation
@Trott please don't merge this! @nschonni did you run For example:
|
We really need #2539, although to be fair, in this case these are wrapped in try/catch so it doesn't throw. But at least we would see them in our console. |
e06a92f
to
6577dbb
Compare
OK, just removed the "console" ones with plain blocks |
@Trott: do you know which library is used upstream for highlighting? It seems metalsmith-prism is archived, so it might be worth looking into switching to the same way it's done upstream in another PR. |
6577dbb
to
ceef027
Compare
Looking at https://github.com/nodejs/node/blob/6723169097759502da11c47389ffb3d650404417/tools/doc/html.js, I guess we're using https://github.com/remarkjs/remark-rehype. |
This isn't ready IMO. When we use fenced code blocks, we need to remove any indented code otherwise we'll end up with extra spaces in the snippets. It seems there are some cases this is missed like https://github.com/nodejs/nodejs.org/pull/2557/files#diff-74f34b44a0285dc0c6cd1f2eeed2e2b5 I didn't go through all of the changes, so I don't know if there are more. |
ceef027
to
64a1981
Compare
locale/pt-br/knowledge/errors/what-are-the-error-conventions.md
Outdated
Show resolved
Hide resolved
LGTM except for my comment above |
locale/en/knowledge/getting-started/control-flow/how-to-write-asynchronous-code.md
Outdated
Show resolved
Hide resolved
locale/pt-br/knowledge/errors/what-are-the-error-conventions.md
Outdated
Show resolved
Hide resolved
aaeca57
to
fa99d0a
Compare
@Trott I think all the major stuff is resolved now. The indentation stuff is as-is for the existing examples |
This is a big change set. @nodejs/website Anyone up for trying to give this a review? |
@Trott we should move forward with #2523 and #2524 so that we don't have to review the snippets manually and that we are consistent. I've left a comment on #2523. As far as this PR goes, it's definitely an improvement. I'd only go through the snippets and fix the indentation while at it. Assuming we don't use any code block languages that prism doesn't support (like |
Easiest way to review it is with the "whitespace ignored" option set, then you just see the code fence lines and the example fix |
Yeah, but in this case whitespace does matter. So, the only safe way is viewing the rich preview of each file which takes time though. |
locale/en/knowledge/getting-started/control-flow/what-are-callbacks.md
Outdated
Show resolved
Hide resolved
This looks good to me. There are 3 unresolved comments and then it can be merged IMO. |
@nschonni can you just address the 2 indentation comments while you change the code snippets? Otherwise someone with push rights could fix them and then just squash. |
Code block style of fenced to match nodejs style
Multiple spaces after blockquote symbol
fa99d0a
to
5b17d67
Compare
Code block style of fenced to match nodejs style