File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed
Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ A Docusaurus v2 plugin that supports referencing code examples from public GitHu
77
88## Install
99
10- First, add the theme plugin to your dependencies as well as ` @babel/plugin-transform-modules-commonjs ` :
10+ First, add the theme plugin to your dependencies:
1111
1212``` sh
13- npm install @saucelabs/theme-github-codeblock @babel/plugin-transform-modules-commonjs
13+ npm install @saucelabs/theme-github-codeblock
1414```
1515
1616## Usage
@@ -25,23 +25,18 @@ Add the theme plugin to your list of themes in the `docusaurus.config.js`:
2525 // ...
2626```
2727
28- in your ` babel.config.js ` please add ` @babel/plugin-transform-modules-commonjs ` to the plugins, e.g.:
29-
30- ``` js
31- module .exports = {
32- presets: [require .resolve (' @docusaurus/core/lib/babel/preset' )],
33- plugins: [
34- ' @babel/plugin-transform-modules-commonjs'
35- ]
36- };
37- ```
38-
3928In order to reference GitHub snippets in your markdown, create code blocks with a ` reference ` attached to the language meta string and put the link to your GitHub reference in the code block, e.g.:
4029
4130 ```js reference
4231 https://github.com/saucelabs/docusaurus-theme-github-codeblock/blob/main/src/theme/ReferenceCodeBlock/index.tsx#L105-L108
4332 ```
4433
34+ You can also set a custom title:
35+
36+ ```js reference title="Example"
37+ https://github.com/saucelabs/docusaurus-theme-github-codeblock/blob/main/src/theme/ReferenceCodeBlock/index.tsx#L105-L108
38+ ```
39+
4540The plugin will download the code and display the desired lines:
4641
4742![ Plugin Example] ( https://github.com/saucelabs/docusaurus-theme-github-codeblock/raw/main/.github/assets/example.png ' Plugin Example ')
You can’t perform that action at this time.
0 commit comments