Skip to content

Book Format #12

@orelby

Description

@orelby

At the moment, the book content is stored in HTML format (and may be edited using a JavaScript WYSIWYG editor). I think that's a mistake, because it's not as flexible as it would be if we used costumized markup. We do need that kind of flexibility, and here are a few examples what for: exercise sections, warning boxes and footnotes. An interpreter could also number images and basically pre-process the book.

I have been writing with LeanPub for a while now, and while I don't think a format that is fully based on Markdown would be the right choise for a book, we could use it as an example. (And add actual markup on top of it.)

An example

Here is a simple example for what we could do:

#Section 1

Hi, this is a paragraph. 

##Sub Section 1.1
This is another paragraph.[^a-footnote]  
A line break can be acheived by leaving two spaces in the end of the line before.

##Section 1.1



Whitespaces between paragraphs, headings and such have no meaning (except the one line break which seperates them, and even that is not required before/after headings, because we know they can only take one line), just like in HTML.

{errorBox}This is an error box.

It can have multiple paragraphs.{/errorBox}

[^a-footnote]: This is a footnote.

And the result:

<section>
    <h2>Section 1</h2>
    <p>Hi, this is a paragraph.</p>
    <section>
        <h2>Sub section 1.1</h2>
        <p>This is another paragraph.<a href="#a-footnote" class="footnote-reference">1</a><br />
        A line break can be acheived by leaving two spaces in the end of the line before.</p>
    </section>
</section>
<section>
    <h2>Section 2</h2>
        <p>Whitespaces between paragraphs, headings and such have no meaning (except the one line break which seperates them, and even that is not required before/after headings, because we know they can only take one line), just like in HTML.</p>
        <div class="error-box">
            <p>This is an error box.</p>
            <p>It can have multiple paragraphs.</p>
        </div>
</section>
<aside class="footnotes">
    <h2>Footnotes</h2>
    <ul>
        <li id="a-footnote"><p>This is a footnote.</p></li>
    </ul>
</aside>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions