docusaurus-plugin-learn-with-code
v2.0.2
Published
![demo](./docs/demo.gif)
Downloads
2
Maintainers
Readme
docusaurus-plugin-learn-with-code
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:
- The input for the
original
andsolution
props should be wrapped with'
chars only. - You can use the
language
prop to select your coding language, the default ispython
.
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] .