docusaurus-plugin-learn-with-code
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

docusaurus-plugin-learn-with-code

demo

Install

npm install docusaurus-plugin-learn-with-code

Configuration

In docusaurus.config.js:

 presets: [
    [
      {
        docs: {
          remarkPlugins: [require('docusaurus-plugin-learn-with-code')]
        }
      }
    ]
 ],
 plugins: [
    require('docusaurus-plugin-learn-with-code/lib/monaco-editor')
 ]

Requirments

The plugin is supported for version 2.0.0-beta.1 of docusaurus and up.

Usage

Input can be either file paths (.txt, .py etc) or an inline text.

Assuming the Python files exist (e.g. original.py and solution.py) in the same directory as the document:

Use the component in .mdx, .jsx or .tsx files:

import { LearningEditor } from 'docusaurus-plugin-learn-with-code/LearningEditor';
import original from '!!raw-loader!./original.py';
import solution from '!!raw-loader!./solution.py';

<LearningEditor 
    original={original}
    solution={solution}
    language='python'
/>

Use code blocks in .md or .mdx files.

```LearningEditor
original='original.py'
solution='great solution'
language='python'
```

Notes:

  1. The input for the original and solution props should be wrapped with ' chars only.
  2. You can use the language prop to select your coding language, the default is python.

Contributing

Contributions are welcome and appreciated. If you find a bug or have suggestions for improvements, feel free to open an Issue or (better yet) submit a Pull Request.

Before merging any PRs, we need all contributors to sign a contributor license agreement. By signing a contributor license agreement, we ensure that the community is free to use your contributions.

When you open a new pull request, a bot will evaluate whether you have signed the CLA. If required, the bot will comment on the pull request, including a link to accept the agreement. The CLA document is also available for review as a PDF.

If the license/cla status check remains on Pending, even though all contributors have accepted the CLA, you can recheck the CLA status by visiting the following link (replace [PRID] with the ID of your PR): https://cla-assistant.io/check/demisto/docusaurus-plugin-learn-with-code?pullRequest=[PRID] .

Package Sidebar

Install

npm i docusaurus-plugin-learn-with-code

Weekly Downloads

1

Version

2.0.2

License

Apache-2.0

Unpacked Size

35.6 kB

Total Files

14

Last publish

Collaborators

  • demistodev