Skip to content

Commit

Permalink
adds some missing notes and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
edublancas committed Apr 24, 2024
1 parent 3f4f35d commit 38147d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ plugins:
- mkdocs-thebe:
# endpoint to the server that manages Python processes
baseUrl: https://endpoint.domain.io
```
```yaml
markdown_extensions:
- pymdownx.highlight:
# required!
pygments_lang_class: true
```
6 changes: 6 additions & 0 deletions src/mkdocs_thebe/assets/mkdocs-thebe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
document$.subscribe(function () {

// Add the data-executable attribute to all code blocks to thebe can find them
document.querySelectorAll('code').forEach(function (code) {
code.setAttribute('data-executable', 'true');
});
Expand All @@ -16,6 +18,10 @@ document$.subscribe(function () {
thebelab.bootstrap();
}


// NOTE: for this to work we need markdown_extensions.pymdownx.highlight with
// pygments_lang_class: true
// otherwise the language-python class is not added to the code block
document.querySelectorAll('div.language-python.highlight').forEach(function (div) {
var pre = div.querySelector('pre');
var button = document.createElement('button');
Expand Down

0 comments on commit 38147d8

Please sign in to comment.