New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Slideshows #150
Comments
The var slideshow = remark.create({
container: document.getElementById('myContainerElement')
}); Optionally, you may also specify a |
I think I misunderstood what multiple slideshows means in this context. I meant multiple Markdown files in the same slideshow. That code would look something like:
This doesn't appear to be the same feature. |
If anyone else runs into this limitation, here is a JavaScript workaround to load things manually: // Place all of your files here
sourceUrls = [
'slides.md',
'solutions.md'
]
var xmlhttp = new XMLHttpRequest();
var source = document.getElementById("source")
for (var i = 0; i < sourceUrls.length; i++) {
xmlhttp.open('GET', sourceUrls[i], false);
xmlhttp.send();
source.innerHTML += "\n" + xmlhttp.responseText;
};
var slideshow = remark.create(); You will need to have this in your HTML: <textarea id="source"></textarea> The code will go through all of the URLs in the array and append them to the source. |
You can pass the combined source to var source = ...
var slideshow = remark.create({
source: source
}); Your workaround essentially does the same thing the |
Quite right. Here is a better version that automatically appends the // Place all of your files here
sourceUrls = [
'1.md',
'2.md'
]
var xmlhttp = new XMLHttpRequest();
var source = ""
for (var i = 0; i < sourceUrls.length; i++) {
xmlhttp.open('GET', sourceUrls[i], false);
xmlhttp.send();
source += xmlhttp.responseText;
// Files shouldn't have --- at the head or foot
// It is added automatically here
if (i + 1 < sourceUrls.length) {
source += "\n---\n"
}
};
var slideshow = remark.create({
source: source
}); |
This should probably be generalized using the not-yet-released macro functionality from #72, present on the develop branch, by creating a macro that synchronously downloads Markdown and inserts it into the slideshow during the parse process, e.g.:
|
#180 is fixed now, so if you wan't to have a go at creating an |
Tried the
on the single version of remark, and it did not work. How can I properly use it? |
@aldarionsevero remark currently doesn't come with any macros, but you can define your own
Then, in your slideshow, |
@aldarionsevero If you're having any issues with this, please open a new issue. |
Include is including properly only one plain slide inside md. Only the first is included. If there is more slides they are left out. And if there is images inside slides there will be an error. |
The reason for that is in line 76ff. of parser.js var value = macro.apply(token.obj, token.args);
if (typeof value === 'string') {
value = self.parse(value, macros);
appendTo(stack[stack.length - 1], value[0].content[0]);
} So the complete return value of the macro will be parsed, but only the first content element of the first slide will be added to the current slide element. In many cases this may be appropriate, but when including complete files it should rather be adding these slides to the stack slides.push(stack[0]); //End current slide
slides.push(...value); //Push slides from include
stack = [createSlide()]; //Start next slide Maybe only do this if more than one slide was returned from the parsed value to not break existing behavior. Edited to add: I raised #488 to track this specific issue. |
The release notes for 0.5 say you can multiple slideshows. I looked and can't find an example of how to do this. Could you provide an example?
The text was updated successfully, but these errors were encountered: