Skip to content

chore: allow cjs and mjs info strings - #176

Merged
Trott merged 1 commit into
nodejs:masterfrom
aduh95:doc-multi-syntax-snippets
Mar 4, 2021
Merged

chore: allow cjs and mjs info strings#176
Trott merged 1 commit into
nodejs:masterfrom
aduh95:doc-multi-syntax-snippets

Conversation

@aduh95

@aduh95 aduh95 commented Feb 23, 2021

Copy link
Copy Markdown
Contributor

It seems ESLint folks are not interested in my meta string proposal, I guess the right move would be to move from

```js esm
// ES module
export {};
```

```js cjs
// CJS module
module.exports = {};
```

```js
// Whichever
console.log();
```

to

```mjs
// ES module
export {};
```

```cjs
// CJS module
module.exports = {};
```

```js
// Whichever
console.log();
```

Refs: nodejs/node#37162
Refs: nodejs/node#37311
Refs: eslint/markdown#170


FWIW, I'd be up to fork the eslint markdown plugin and maintain ourselves support for the meta string instead, but maybe it's not worth the maintenance burden.

@nschonni nschonni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm assuming this works with HighlightJS/Prism and that maybe there is a downstream need to update those CSS/JS bundles to support this when building the docs in nodejs/node

@nschonni

Copy link
Copy Markdown
Member

This was the other "metadata" style I was trying to think of before https://prettier.io/blog/2020/11/20/2.2.0.html#align-code-block-language-detection-with-other-popular-tools-9365httpsgithubcomprettierprettierpull9365-by-kachkaevhttpsgithubcomkachkaev

@aduh95

aduh95 commented Feb 23, 2021

Copy link
Copy Markdown
Contributor Author

I'm assuming this works with HighlightJS

Yes, it works with highlight.js (not sure for Prism), so no need to change the nodejs/node doc generation tooling.

@aduh95

aduh95 commented Mar 1, 2021

Copy link
Copy Markdown
Contributor Author

@nodejs/linting Should we land this?

@aduh95

aduh95 commented Mar 4, 2021

Copy link
Copy Markdown
Contributor Author

@Trott Any chance you'll have time to publish this to npm? I don't think I have the permission to do it myself.

@Trott
Trott merged commit 5a93237 into nodejs:master Mar 4, 2021
@Trott

Trott commented Mar 4, 2021

Copy link
Copy Markdown
Member

Published 2.1.1 which includes this.

@aduh95
aduh95 deleted the doc-multi-syntax-snippets branch March 4, 2021 20:32
Trott pushed a commit to aduh95/node that referenced this pull request Mar 6, 2021
Refs: nodejs/remark-preset-lint-node#176

PR-URL: nodejs#37605
Refs: nodejs#37162
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
aduh95 added a commit to aduh95/node that referenced this pull request Mar 6, 2021
danielleadams pushed a commit to nodejs/node that referenced this pull request Mar 16, 2021
Refs: nodejs/remark-preset-lint-node#176

PR-URL: #37605
Refs: #37162
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
danielleadams pushed a commit to nodejs/node that referenced this pull request Mar 16, 2021
targos pushed a commit to nodejs/node that referenced this pull request May 30, 2021
targos pushed a commit to nodejs/node that referenced this pull request Jun 5, 2021
targos pushed a commit to nodejs/node that referenced this pull request Jun 5, 2021
targos pushed a commit to nodejs/node that referenced this pull request Jun 11, 2021
targos pushed a commit to targos/node that referenced this pull request Aug 8, 2021
Refs: nodejs/remark-preset-lint-node#176

PR-URL: nodejs#37605
Refs: nodejs#37162
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Sep 1, 2021
Refs: nodejs/remark-preset-lint-node#176

PR-URL: nodejs#37605
Refs: nodejs#37162
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit to nodejs/node that referenced this pull request Sep 1, 2021
Refs: nodejs/remark-preset-lint-node#176

PR-URL: #37605
Refs: #37162
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants