-
Notifications
You must be signed in to change notification settings - Fork 19
Add sandboxes to repo #6
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
Merged
wooorm
merged 15 commits into
remarkjs:main
from
ChristianMurphy:sandbox-starters-in-repo
Nov 24, 2021
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d0c12e0
docs: move sandbox examples into the repository
ChristianMurphy 509ccb7
Apply suggestions from code review
ChristianMurphy 2443f29
style: run prettier on code
ChristianMurphy 7356c0f
style: add prettier and xo
ChristianMurphy f35e86d
docs: add stackblitz links
ChristianMurphy 152e8f7
Merge branch 'main' into sandbox-starters-in-repo
ChristianMurphy cb9269e
style: resolve xo warnings
ChristianMurphy f72c93f
Update code style in issue form
ChristianMurphy c4bda0d
docs: describe how to update dependencies on stackblitz
ChristianMurphy 2bf73b8
style: use async main function
ChristianMurphy e897055
docs: update react markdown starter to use typescript
ChristianMurphy 9eccb88
test: resolve xo warnings
ChristianMurphy 8e0febb
test: include workspace in dependency installation
ChristianMurphy 2632eaa
docs: fix tsx import
ChristianMurphy 57dee0a
docs: add sandbox configuration files
ChristianMurphy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| *.md | ||
| *.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,14 +12,32 @@ | |
| "Titus Wormer <[email protected]> (wooorm.com)" | ||
| ], | ||
| "devDependencies": { | ||
| "eslint-config-xo-react": "^0.25.0", | ||
| "prettier": "^2.0.0", | ||
| "remark-cli": "^10.0.0", | ||
| "remark-frontmatter": "^4.0.0", | ||
| "remark-preset-wooorm": "^9.0.0" | ||
| "remark-preset-wooorm": "^9.0.0", | ||
| "xo": "^0.46.0" | ||
| }, | ||
| "scripts": { | ||
| "format": "remark . -qfo", | ||
| "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
| "test": "npm run format" | ||
| }, | ||
| "prettier": { | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "singleQuote": true, | ||
| "bracketSpacing": false, | ||
| "semi": false, | ||
| "trailingComma": "none" | ||
| }, | ||
| "xo": { | ||
| "extends": "xo-react", | ||
| "prettier": true, | ||
| "env": [ | ||
| "browser" | ||
| ] | ||
| }, | ||
| "remarkConfig": { | ||
| "plugins": [ | ||
| "frontmatter", | ||
|
|
||
26 changes: 26 additions & 0 deletions
26
sandbox-templates/react-markdown-with-create-react-app/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "react-markdown-with-create-react-app", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "main": "src/index.jsx", | ||
| "dependencies": { | ||
| "react": "17.0.2", | ||
| "react-dom": "17.0.2", | ||
| "react-markdown": "7.1.0", | ||
| "react-scripts": "4.0.3" | ||
| }, | ||
| "devDependencies": { | ||
| "typescript": "3.8.3" | ||
ChristianMurphy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "scripts": { | ||
| "start": "react-scripts start", | ||
| "build": "react-scripts build", | ||
| "test": "react-scripts test --env=jsdom" | ||
| }, | ||
| "browserslist": [ | ||
| ">0.2%", | ||
| "not dead", | ||
| "not ie <= 11", | ||
| "not op_mini all" | ||
| ] | ||
| } | ||
14 changes: 14 additions & 0 deletions
14
sandbox-templates/react-markdown-with-create-react-app/public/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>react-markdown + CRA</title> | ||
| </head> | ||
| <body> | ||
| <noscript> | ||
| You need to enable JavaScript to run this app. | ||
| </noscript> | ||
| <div id="root"></div> | ||
| </body> | ||
| </html> |
22 changes: 22 additions & 0 deletions
22
sandbox-templates/react-markdown-with-create-react-app/src/app.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // ⚠️ Important! Please make sure the dependencies are up to date. | ||
| // On code sandbox, you can refresh them in the Dependencies section (left-bottom) | ||
| // On stackblitz, you can open the package.json file, update the versions, | ||
| // then run npm install in the stackblitz terminal | ||
|
|
||
| import React from 'react' | ||
| import Markdown from 'react-markdown' | ||
|
|
||
| const markdownSource = ` | ||
| # heading | ||
|
|
||
| * list | ||
| * items | ||
|
|
||
| \`\`\`js | ||
| function () {} | ||
| \`\`\` | ||
| ` | ||
|
|
||
| const App = () => <Markdown>{markdownSource}</Markdown> | ||
|
|
||
| export default App |
13 changes: 13 additions & 0 deletions
13
sandbox-templates/react-markdown-with-create-react-app/src/index.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import React, {StrictMode} from 'react' | ||
| import ReactDOM from 'react-dom' | ||
|
|
||
| import App from './app.jsx' | ||
|
|
||
| const rootElement = document.querySelector('#root') | ||
|
|
||
| ReactDOM.render( | ||
| <StrictMode> | ||
| <App /> | ||
| </StrictMode>, | ||
| rootElement | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <title>remark-rehype + Parcel demo</title> | ||
| <meta charset="utf-8"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <h1><code>remark-rehype</code> with Parcel</h1> | ||
| <h2>source</h2> | ||
ChristianMurphy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <pre id="source"></pre> | ||
| <h2>result</h2> | ||
| <iframe id="result"></iframe> | ||
| <h2>error</h2> | ||
| <pre id="error">none</pre> | ||
|
|
||
| <script src="src/index.js"></script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "remark-rehype-with-parcel", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "main": "index.html", | ||
| "scripts": { | ||
| "start": "parcel index.html --open", | ||
| "build": "parcel build index.html" | ||
| }, | ||
| "dependencies": { | ||
| "rehype-stringify": "9.0.2", | ||
| "remark-parse": "10.0.1", | ||
| "remark-rehype": "10.0.1", | ||
| "unified": "10.1.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "7.16.0", | ||
| "parcel-bundler": "1.12.5" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // ⚠️ Important! Please make sure the dependencies are up to date. | ||
| // On code sandbox, you can refresh them in the Dependencies section (left-bottom) | ||
| // On stackblitz, you can open the package.json file, update the versions, | ||
| // then run npm install in the stackblitz terminal | ||
|
|
||
| import {unified} from 'unified' | ||
| import remarkParse from 'remark-parse' | ||
| import remarkRehype from 'remark-rehype' | ||
| import rehypeStringify from 'rehype-stringify' | ||
|
|
||
| const sourceMarkdown = ` | ||
| # heading | ||
|
|
||
| * list | ||
| * item | ||
|
|
||
| \`\`\`js | ||
| function () {} | ||
| \`\`\` | ||
| ` | ||
|
|
||
| document.querySelector('#source').textContent = sourceMarkdown | ||
|
|
||
| unified() | ||
| .use(remarkParse) | ||
| // Add any remark plugins here | ||
| .use(remarkRehype) | ||
| // Add any rehype plugins here | ||
| .use(rehypeStringify) | ||
| .process(sourceMarkdown) | ||
| .then((file) => { | ||
| document.querySelector('#result').contentWindow.document.body.innerHTML = | ||
| String(file) | ||
| }) | ||
| .catch((error) => { | ||
| document.querySelector('#error').textContent = error | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <title>remark + Parcel demo</title> | ||
| <meta charset="utf-8" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <h1><code>remark</code> with Parcel</h1> | ||
| <h2>source</h2> | ||
ChristianMurphy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <pre id="source"></pre> | ||
| <h2>result</h2> | ||
| <pre id="result"></pre> | ||
| <h2>error</h2> | ||
| <pre id="error">none</pre> | ||
|
|
||
| <script src="src/index.js"></script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "name": "remark-with-parcel", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "main": "index.html", | ||
| "scripts": { | ||
| "start": "parcel index.html --open", | ||
| "build": "parcel build index.html" | ||
| }, | ||
| "dependencies": { | ||
| "remark": "14.0.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "7.16.0", | ||
| "parcel-bundler": "1.12.5" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // ⚠️ Important! Please make sure the dependencies are up to date. | ||
| // On code sandbox, you can refresh them in the Dependencies section (left-bottom) | ||
| // On stackblitz, you can open the package.json file, update the versions, | ||
| // then run npm install in the stackblitz terminal | ||
|
|
||
| import {remark} from 'remark' | ||
|
|
||
| const sourceMarkdown = ` | ||
| # heading | ||
|
|
||
| * list | ||
| * item | ||
|
|
||
| \`\`\`js | ||
| function () {} | ||
| \`\`\` | ||
| ` | ||
|
|
||
| document.querySelector('#source').textContent = sourceMarkdown | ||
|
|
||
| remark() | ||
| // .use remark plugins here | ||
| .process(sourceMarkdown) | ||
| .then((file) => { | ||
| document.querySelector('#result').textContent = String(file) | ||
| }) | ||
| .catch((error) => { | ||
| document.querySelector('#error').textContent = error | ||
| }) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temporary links until merged