While the above allows you to generate correct EPUB and PDF files, it will still display all the content if the reader chooses to read your book linearly.
This output is similar to the standalone HTML output, except the option to display only a chapter at a time is always true, and there is no way to display the table of contents.
If you want to include Markdown formatting in the Javascript code (to display a passage or another without having to write HTML code), you can use the `@"..."@` syntax:
Sometimes, you want some text (or Javascript code) to only be displayed (or run) when the reader reads this passage the first time, or alternatively when she goes back to it.
While it is trivial to add some code to check that, it is a common enough pattern to justify its
own variant:
you'll juste have to insert a named code block with the number:
**html.if.new_game** allows you to specify the path to a Javascript that will be run at the beginning of the game.
Since this code is not embedded in a function and is at the root (and the beginning) of the document, it is a good place to declare all the functions and the global variables you might need for your interactive fiction mechanics.
**html.if.new_turn** and **html.if.end_turn** allow you to specify some Javascript code that will be executed at the beginning and the end of each segment.
Unlike `html.if.new_game`, the (usually shorter) code is specified inline, and can return a string value that will be displayed at the beginning and the end of each segment.
This is exactly like including code blocks at the beginning or the end of each of your Markdown file.