This code works perfectly in Javascript, but I was just curious if anyone knew what the vanilla javascript method would be for doing this? $.wiki('<<replace "#randomDivElement">><<include "someOtherPassage">><</replace>>');
Using Story.get I was able to get the text of “someOtherPassage” but I’m also setting variables in that passage and they weren’t working out properly…
Ahhhh lol thanks. I didn’t realise there was a difference between DOM and not DOM lol. Got a lot to learn.
I think I also finally realised what the wiki example in Sugarcube’s documentation is actually doing.
$('#the-box').wiki('Who //are// you?');
That code grabs the element with id called “the-box” and then appends ‘Who are you?’ into the box. In normal html double “//” doesn’t mean anything, but in Sugarcube it means italic. So this little piece of code is turning it into processed(??) html and also sticking it inside the element?
Yes. The $('#the-box') part selects the matching element, while the wiki('Who //are// you?') part renders the passed text and appends it to the selected element(s).