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

tools,doc: add support for several flavors of JS code snippets #37162

Merged
merged 1 commit into from
Mar 6, 2021

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jan 31, 2021

Enable code example using both modern ESM syntax and legacy CJS syntax.
It adds a toggle on the web interface to let users switch from one JavaScript flavor to the other.

html.js detects code snippets with a meta attribute:

```mjs
export default {};
```
```cjs
'use strict';
module.exports = {};
```

And adds a <input type=checkbox> toggle:

Toggle ESM
Toggle CJS

With dark mode on

Toggle ESM, with dark mode
Toggle CJS, with dark-mode

Originally suggested by @jasnell in #37077 (comment).

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory. labels Jan 31, 2021
@aduh95
Copy link
Contributor Author

aduh95 commented Feb 3, 2021

@nodejs/documentation @nodejs/website wdyt?

@aduh95 aduh95 added the review wanted PRs that need reviews. label Feb 8, 2021
aduh95 added a commit to aduh95/node that referenced this pull request Feb 10, 2021
aduh95 added a commit to aduh95/remark-preset-lint-node that referenced this pull request Feb 23, 2021
aduh95 added a commit to aduh95/remark-preset-lint-node that referenced this pull request Feb 23, 2021
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the blocked PRs that are blocked by other issues or PRs. label Feb 23, 2021
@aduh95
Copy link
Contributor Author

aduh95 commented Feb 23, 2021

Adding the blocked label, as this implementation is probably going to conflict with the next linter update. I'll update this once nodejs/remark-preset-lint-node#176 lands on nodejs/node master.

Trott pushed a commit to nodejs/remark-preset-lint-node that referenced this pull request Mar 4, 2021
aduh95 added a commit to aduh95/node that referenced this pull request Mar 4, 2021
@aduh95 aduh95 force-pushed the doc-multi-syntax-snippets branch from d3915e0 to 39f1184 Compare March 4, 2021 21:10
@aduh95
Copy link
Contributor Author

aduh95 commented Mar 4, 2021

433badd is part of #37604, this PR needs to wait for the other one to land first, other than that it should be ready.

//cc @nodejs/documentation

@jasnell
Copy link
Member

jasnell commented Mar 4, 2021

#37604 has landed now :-)

@jasnell jasnell removed the blocked PRs that are blocked by other issues or PRs. label Mar 4, 2021
aduh95 added a commit to aduh95/node that referenced this pull request Mar 4, 2021
@aduh95 aduh95 force-pushed the doc-multi-syntax-snippets branch from 39f1184 to 886be29 Compare March 4, 2021 21:57
Enable code example using both modern ESM syntax and legacy CJS syntax.
It adds a toggle on the web interface to let users switch from one
JavaScript flavor to the other.

PR-URL: nodejs#37162
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@aduh95 aduh95 force-pushed the doc-multi-syntax-snippets branch from 5c79ba2 to 2e1e74e Compare March 6, 2021 15:14
@aduh95
Copy link
Contributor Author

aduh95 commented Mar 6, 2021

Landed in 2e1e74e

@aduh95 aduh95 merged commit 2e1e74e into nodejs:master Mar 6, 2021
@aduh95 aduh95 deleted the doc-multi-syntax-snippets branch March 6, 2021 15:15
jasnell added a commit that referenced this pull request Mar 11, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #37594
Refs: #37162
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
danielleadams pushed a commit 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 that referenced this pull request Mar 16, 2021
danielleadams pushed a commit that referenced this pull request Mar 16, 2021
Enable code example using both modern ESM syntax and legacy CJS syntax.
It adds a toggle on the web interface to let users switch from one
JavaScript flavor to the other.

PR-URL: #37162
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
danielleadams pushed a commit that referenced this pull request Mar 16, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #37594
Refs: #37162
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 16, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #37594
Refs: #37162
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
targos pushed a commit that referenced this pull request May 30, 2021
targos pushed a commit that referenced this pull request May 30, 2021
Enable code example using both modern ESM syntax and legacy CJS syntax.
It adds a toggle on the web interface to let users switch from one
JavaScript flavor to the other.

PR-URL: #37162
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
targos pushed a commit that referenced this pull request Jun 5, 2021
targos pushed a commit that referenced this pull request Jun 5, 2021
Enable code example using both modern ESM syntax and legacy CJS syntax.
It adds a toggle on the web interface to let users switch from one
JavaScript flavor to the other.

PR-URL: #37162
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
targos pushed a commit that referenced this pull request Jun 5, 2021
targos pushed a commit that referenced this pull request Jun 5, 2021
Enable code example using both modern ESM syntax and legacy CJS syntax.
It adds a toggle on the web interface to let users switch from one
JavaScript flavor to the other.

PR-URL: #37162
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
targos pushed a commit that referenced this pull request Jun 11, 2021
targos pushed a commit that referenced this pull request Jun 11, 2021
Enable code example using both modern ESM syntax and legacy CJS syntax.
It adds a toggle on the web interface to let users switch from one
JavaScript flavor to the other.

PR-URL: #37162
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
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 Aug 13, 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 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>
Marlyfleitas added a commit to Marlyfleitas/Node-remark-preset-lint that referenced this pull request Aug 26, 2022
patrickm68 added a commit to patrickm68/Node-preset-lint that referenced this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. review wanted PRs that need reviews. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants