Paragraph designation when exporting to HTML

When exporting to HTML, is there a way to change when a line is designated as a new paragraph and given the paragraph tags?

For example, if I have a note with the following text:

First paragraph line 1
First paragraph line 2
First paragraph line 3

Next paragraph line 1
Next paragraph line 2
Next paragraph line 3

It will export in HTML as:

<p>First paragraph line 1</p>
<p>First paragraph line 2</p>
<p>First paragraph line 3</p>

<p>Next paragraph line 1</p>
<p>Next paragraph line 2</p>
<p>Next paragraph line 3</p>

What I would like is:

<p>First paragraph line 1
First paragraph line 2
First paragraph line 3</p>

<p>Next paragraph line 1
Next paragraph line 2
Next paragraph line 3</p>

Thanks!

Each note has its own markup attributes. So, you could explode each line into its own note, and modify the markup for each note.

Note that there are separate attributes for $HTMLParagraphStart/End and for $HTMLFirstParagraphStart/End.

Thanks for your quick response!

I did take a look at the documentation and I saw the $HTMLParagraphStart/End attributes that you mentioned. However, I don’t think that’s what needs to be modified, but I could be wrong since I’m new to TBX.

I think what needs to be modified is where TBX designates a new paragraph. It looks like it designates a new paragraph at a single newline, but I would like to change it so it designates it at two newlines.

Thanks for your help!

That was going to be my new question: how do we recognize where the paragraph starts?

Short answer: you can’t change this.

Clever answer: you can, if you want! Three ways:

  1. Quick and dirty: Search and replace double newlines with a place marker string — perhaps “•”. Now, replace all remaining newlines with the empty string. Finally, replace your place marker string with a single newline \n.

  2. Less quick, less dirty: Explode your text at double newlines. For the exploded notes, omit paragraph markup entirely, and insert <p> and </p> before and after the text in the template.

  3. Less dirty, arguably: use ctrl-Return to obtain a line break in Tinderbox that is not treated as a paragraph ending for export.

Thanks, the ctrl-Enter did the trick!

The alternative approach is to use
tags in HTML or Markdown. Using <br> over ctrl-return could give you more control down the road as you can use action code to easily remove them later

Figure: Text

Figure: Preview

Figure: HTML

1 Like