Skip to content

Commit

Permalink
Add custom remark-code-import using basePath. See kevin940726/remark-…
Browse files Browse the repository at this point in the history
…code-import#17.

Update paths and code blocks.
Need to fix the actual snippet packages.
  • Loading branch information
johnrom committed Nov 18, 2021
1 parent fd07b05 commit ad3808c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/code-snippets-website/content/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ I've created a snippet surrounding the header of this very website. If there is
### The Markdown:

````md
```tsx file=./src/header/header.tsx@header
```tsx file=./src/header/header.tsx snippet=header

```
````

### The Output:

```tsx file=./src/header/header.tsx@header
```tsx file=./src/header/header.tsx snippet=header

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ slug: '/docs/preserving-snippets'

Sometimes you want to show how `nmbl-code-snippets` works, like when using this very project. In that case, you can add preserve-snippets to the code block metadata, like so:

```md file=content/docs/index.md@preserve-snippets
```md file=content/docs/index.md snippet=preserve-snippets

```
11 changes: 4 additions & 7 deletions packages/code-snippets-website/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,19 @@ module.exports = {
options: {
plugins: [
{
resolve: 'remark-code-import/gatsby',
resolve: '@johnrom/remark-code-import/gatsby',
options: {
async: true,
basePath: process.cwd(),
},
},
{
resolve: '@nmbl/gatsby-remark-code-snippets',
options: {
async: true,
},
options: {},
},
{
resolve: '@nmbl/gatsby-remark-code-snippet-remover',
options: {
async: true,
},
options: {},
},
],
},
Expand Down
1 change: 1 addition & 0 deletions packages/code-snippets-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"react-dom": "^17.0.2"
},
"devDependencies": {
"@johnrom/remark-code-import": "0.4.1-beta1",
"@types/react": "^17.0.35",
"@types/react-dom": "^17.0.11",
"gatsby-plugin-postcss": "^4.14.0",
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,14 @@
"@types/yargs" "^16.0.0"
chalk "^4.0.0"

"@johnrom/[email protected]":
version "0.4.1-beta1"
resolved "https://registry.yarnpkg.com/@johnrom/remark-code-import/-/remark-code-import-0.4.1-beta1.tgz#82754cf9e4ade0f1e7c4b9c8671ecded9b68e42e"
integrity sha512-754fjSOKGNI7XcYbSr45bTIDKfXv7mzF8+p9G6iTtIK+y/d2628DpmIRV2wjYVp6wJ+o+hfDuI1Zs5U8JfBX3A==
dependencies:
to-gatsby-remark-plugin "^0.1.0"
unist-util-visit "^2.0.1"

"@lerna/[email protected]":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@lerna/add/-/add-4.0.0.tgz#c36f57d132502a57b9e7058d1548b7a565ef183f"
Expand Down

0 comments on commit ad3808c

Please sign in to comment.