Repository navigation
Conversation
|
Sorry for the delay, we now have an mdbook team so things should move a bit faster here. This sounds like a very good idea to add an example! Do you mind adding a GUI test to ensure that the code you provided won't become outdated when we make updates? |
|
Reminder, once the PR becomes ready for a review, use |
|
Thank you for your review. When I wrote this documentation, I understood that review bandwidth was extremely limited, If minor changes are acceptable, I can clean up some of the JavaScript hacks, what do you think? mdBook/crates/mdbook-html/src/html/tree.rs Line 1010 in 74b14bb the section titled "Restrict the .playground selector to <pre>" will no longer be necessary.
|
|
If that can make things simpler, then it's worth a try! |
|
I wrote 2 issues to improve custome playground support. |
|
@GuillaumeGomez Regarding #3216, since it would have a bit large impact, such as requiring the addition of a configuration value, If there is no prospect of it being accepted in the short term, I am also open to rewriting this guide on the assumption that #3216 can't be used. |
|
I created #3241. |
5dde35f to
3535c49
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@GuillaumeGomez |
| "use strict"; | ||
|
|
||
| // Replace with a call to your runtime. | ||
| function example_language_run(source) { |
There was a problem hiding this comment.
Can we include a file directly? That would allow:
- To not duplicate content between here and the GUI test.
- Prevent this one to become outdated.
|
|
||
| The final directory structure becomes below: | ||
|
|
||
| ``` |
There was a problem hiding this comment.
| ``` | |
| ```text |
| var oop = require("../lib/oop"); | ||
| var TextMode = require("./text").Mode; | ||
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | ||
| var Rules = function() { | ||
| this.$rules = { start: [{ token: "keyword", regex: "\\bprint\\b" }] }; | ||
| }; | ||
| oop.inherits(Rules, TextHighlightRules); | ||
| var Mode = function() { this.HighlightRules = Rules; }; |
There was a problem hiding this comment.
| var oop = require("../lib/oop"); | |
| var TextMode = require("./text").Mode; | |
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
| var Rules = function() { | |
| this.$rules = { start: [{ token: "keyword", regex: "\\bprint\\b" }] }; | |
| }; | |
| oop.inherits(Rules, TextHighlightRules); | |
| var Mode = function() { this.HighlightRules = Rules; }; | |
| const oop = require("../lib/oop"); | |
| const TextMode = require("./text").Mode; | |
| const TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
| const Rules = function() { | |
| this.$rules = { start: [{ token: "keyword", regex: "\\bprint\\b" }] }; | |
| }; | |
| oop.inherits(Rules, TextHighlightRules); | |
| const Mode = function() { this.HighlightRules = Rules; }; |
| ace.define("ace/mode/example", | ||
| ["require", "exports", "ace/lib/oop", "ace/mode/text", "ace/mode/text_highlight_rules"], | ||
| function(require, exports) { | ||
| var oop = require("../lib/oop"); |
There was a problem hiding this comment.
Need to apply the suggested changes below. One more argument in favour of including a file rather than duplicating content. :)
This PR documents how to implement custom playgrounds.
This is a successor to PR #2286.
The method described in #2286 is no longer available in v0.5, so it has been rewritten for v0.5, and
it was possible to implement it with fewer patches than the previous version.
Related: #350 #1453 #1759