Notebook Markup: Headers and Whitespace

In Notebook 2, you can add section headers into your pages. This, for example, gets turned into a first-level header:

    = All About Penguins =

Or, rather, it sometimes gets turned into a first-level header. There pretty much has to be a blank line before it; if you enter something like the following, your header will become part of the previous paragraph:

    ...end of previous sentence.
    = All About Penguins =

Also, in Notebook 2 you have to remember the space characters; this won’t work:

    =All About Penguins=

I’ve fixed all of these things in the new parser, which is a good thing. However, there are still some issues.

In normal HTML, text marked as a header will typically get separated from the preceding and following paragraphs by a certain amount of whitespace. In Notebook 2, by contrast, you get blank lines where you put blank lines in the text of your page. That means you always get at least one blank line before a header (since, as I noted above, it isn’t a header without one) and you get a blank line after a header only if you want one. That is, this gives you a blank line:

    = All About Penguins =

    Penguins are fierce creatures who roam the Antarctic veldt.

And this doesn’t:

    = All About Penguins =
    Penguins are fierce creatures who roam the Antarctic veldt.

I can retain this behavior, or I can change it so that blank lines before and after the header line in the input are ignored, and the header always gets whitespace before and after.

Any one have any thoughts one way or the other?

2 thoughts on “Notebook Markup: Headers and Whitespace

  1. I would go for the HTML behaviour, alwas whitespace before and after, amount possibly dependent on the level of the header (*). I think that this more in line with typographical conventions.

    (*) Is that something which could be left to a CSS file ? (For HTML only, Text widget … Tags can do that, right ? So the set of tag configuration woulds essentially be a style).

    Like

  2. The text widget isn’t an issue; nbm3 markup will always be rendered via conversion to HTML as displayed by Tkhtml3, and mediated by a special
    CSS style sheet. Thus, it’s conceivable that the user could be allowed to specify additional CSS styles, overriding the defaults.

    I’ll think about this.

    Like

Comments are closed.