Writing Rich Text Entries#

LabArchives rich-text entries use HTML for formatting. The examples below show common markup patterns you can pass to TextEntry.

Create a Rich Text Entry#

The examples below assume you already have a page object:

from labapi import TextEntry

page.entries.create(TextEntry, "<p>This is a rich text entry.</p>")

For a broader HTML reference, see the MDN HTML elements reference.

Common HTML Patterns#

Paragraphs#

Use <p> tags for basic paragraphs:

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

Text Formatting#

Use standard HTML tags for common inline formatting:

  • Bold: <b>bold text</b>

  • Italic: <i>italic text</i>

  • Underline: <u>underlined text</u>

  • Strikethrough: <s>strikethrough text</s>

Example:

<p>
    This paragraph contains <b>bold</b>,
    <i>italic</i>,
    <u>underlined</u>,
    and <s>strikethrough</s> text.
</p>

Text Color#

Use the style attribute with the color property:

<p style="color:red;">This text is red.</p>
<p style="color:#0000ff;">This text is blue.</p>

Tables#

Create tables with <table>, <tr>, <th>, and <td>:

<table border="1">
    <tr>
        <th>Header 1</th>
        <th>Header 2</th>
    </tr>
    <tr>
        <td>Row 1, Cell 1</td>
        <td>Row 1, Cell 2</td>
    </tr>
    <tr>
        <td>Row 2, Cell 1</td>
        <td>Row 2, Cell 2</td>
    </tr>
</table>

Lists#

Use <ul> or <ol> with <li> items:

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
</ul>
<ol>
    <li>First item</li>
    <li>Second item</li>
    <li>Third item</li>
</ol>