lotus-convert-rich-text-fields
Converts Lotus Notes rich text fields to standard formats (HTML, markdown, plain text). Use when migrating formatted content, extracting text styling and formatting, handling embedded objects (images, attachments, tables), or preparing rich text data for new systems.
What this skill does
Works with rich text content extraction, format conversion, embedded media handling, and formatting preservation strategies.
# Convert Lotus Notes Rich Text Fields
## Table of Contents
**Quick Start** → [What Is This](#purpose) | [When to Use](#when-to-use) | [Simple Example](#examples)
**How to Implement** → [Step-by-Step](#instructions) | [Expected Outcomes](#quick-start)
**Reference** → [Requirements](#requirements) | [Related Skills](#see-also)
## Purpose
Lotus Notes rich text fields store complex formatted content including bold, italic, colors, fonts, tables, embedded images, and attachments. These formats aren't compatible with modern systems. This skill guides you through extracting and converting this rich content to standard formats (HTML, markdown, or plain text) while preserving important information and maintaining usability.
## When to Use
Use this skill when you need to:
- **Migrate formatted content** - Convert rich text fields to modern formats (HTML, markdown, plain text)
- **Extract text styling and formatting** - Preserve bold, italic, fonts, colors, and structure
- **Handle embedded objects** - Process images, attachments, and tables within rich text
- **Prepare data for new systems** - Ensure rich text data is compatible with target platforms
- **Assess formatting complexity** - Determine which formatting needs to be preserved vs. simplified
- **Validate conversion quality** - Test that converted content maintains critical information
This skill is essential for data migration projects where Lotus Notes rich text fields contain important formatted information that must be preserved.
## Quick Start
To convert rich text fields:
1. Identify all rich text fields in your NSF database
2. Assess formatting complexity (simple text vs. tables/images/embedded objects)
3. Choose target format (HTML for maximum fidelity, markdown for readability, plain text for simplicity)
4. Implement extraction and conversion logic
5. Test with real data to validate formatting
6. Handle edge cases: embedded images, broken formatting, very long content
7. Validate output quality and completeness
## Instructions
### Step 1: Identify Rich Text Fields
Locate all rich text fields in your Lotus Notes database:
**Search for:**
- Form definitions with field type "RichText" or "RT"
- Documentation listing rich text usage
- Backend code that creates or modifies rich text fields
**Document for each field:**
- Field name and form it appears on
- What content does it store? (notes, descriptions, comments, documentation)
- How important is formatting? (critical vs. nice-to-have)
- Typical content size (small notes vs. large documents)
- Do documents contain embedded images or attachments?
- Are tables used?
Example inventory:
```
Form: Order
- NotesField (RichText)
Purpose: Internal notes about order
Formatting: Bold, italics, sometimes tables
Images: Occasionally (scanned receipts)
Average size: 1-5 KB
Form: ComplianceDocument
- DocumentContent (RichText)
Purpose: Official compliance documentation
Formatting: Extensive (multi-level headers, formatted lists, tables)
Images: Many (regulatory documents, photographs)
Average size: 100-500 KB
Critical: Yes—formatting must be preserved
```
### Step 2: Analyze Formatting Requirements
Assess how much formatting needs to be preserved:
**For each rich text field, determine:**
1. **Formatting complexity level:**
- **Simple** (Bold, italic, underline only)
→ Markdown or simple HTML is sufficient
- **Moderate** (Multiple fonts, colors, structured lists)
→ HTML with CSS is needed
- **Complex** (Tables, nested lists, images, special formatting)
→ Full HTML with embedded media handling
2. **Content types present:**
- Plain text only
- Text with basic formatting
- Tables or structured data
- Embedded images
- Attached files
- Multi-level lists or outlines
3. **Target system requirements:**
- Can target system handle HTML?
- Is markdown supported?
- Must formatting be stripped?
- Can target system store images/attachments?
Example assessment:
```
Field: OrderNotes
Formatting complexity: Simple
Content types: Text, bold, italics
Target system: Supports HTML
Strategy: Convert to HTML with basic tags (strong, em, p)
Field: TechnicalSpec
Formatting complexity: Complex
Content types: Text, headers, code blocks, images, tables
Target system: Markdown rendering engine
Strategy: Convert to markdown with inline images as base64
```
### Step 3: Choose Conversion Strategy
Select the appropriate target format:
**HTML (Maximum Fidelity):**
- Preserves all formatting, fonts, colors
- Can embed images directly or store as data URIs
- Target system must support HTML rendering
- Best for: Complex formatted documents
```html
<p><strong>Order Status:</strong> <em>Approved</em></p>
<table>
<tr>
<td>Item 1</td>
<td>$100</td>
</tr>
</table>
```
**Markdown (Readable & Portable):**
- Simplifies formatting to essential elements
- Easy to version control and diff
- Works in many modern systems
- Best for: Documentation, notes with moderate formatting
```markdown
**Order Status:** _Approved_
| Item | Price |
|------|-------|
| Item 1 | $100 |
```
**Plain Text (Simplest):**
- Removes all formatting
- Maximum compatibility
- Loss of structure
- Best for: Legacy systems, when formatting isn't important
```
Order Status: Approved
Item 1 - $100
```
### Step 4: Extract Rich Text Content
Get the raw rich text data from NSF documents:
**For small migrations**, manually export:
1. Open NSF in Lotus Notes Designer
2. Use "Export" to save documents as XML or text files
3. Extract rich text content from export
**For larger data sets**, programmatically extract:
```python
# If using Domino HTTP API or LotusScript export
def extract_rich_text_from_domino(doc_id: str, field_name: str) -> str:
"""
Extract rich text content from Domino document via HTTP API.
Returns raw rich text markup (RTF-like format from Lotus).
"""
# This depends on your Domino API access
# Typically returns something like:
# {RTFFIELD "OrderNotes" "This is a note with \f formatting"}
pass
```
**Understanding Lotus Rich Text format:**
Lotus stores rich text in a proprietary binary format. When exported, it may appear as:
- RTF (Rich Text Format)
- MIME with embedded formatting
- Custom Lotus markup
Example exported format:
```
{\rtf1\ansi\ansicpg1252
{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red0\green0\blue0;}
\uc1\pard\plain\deftab720\f0\fs20
Order Status: \b Approved\b0\par
Items:\par
\trowd\trgaph108\trleft-108\trbrdrl\brdrs
\trbrdrt\brdrs\trbrdrb\brdrs\trbrdrr\brdrs
\trbrdrh\brdrs\trbrdrv\brdrs\tbrdrva\brdrs
\clbrdrl\brdrs\clbrdrt\brdrs\clbrdrb\brdrs
\clbrdrr\brdrs \cellx1440\f0\fs20 Item 1\cell
\cellx2880\f0\fs20 $100\cell\row\pard
\plain\f0\fs20\par}
```
### Step 5: Implement Conversion Functions
Create converters for your chosen format:
**Example: Convert to HTML**
```python
from typing import Optional
import re
import html as html_module
class RichTextConverter:
"""Convert Lotus Notes rich text to HTML."""
@staticmethod
def rtf_to_html(rtf_content: str) -> str:
"""
Convert RTF (Rich Text Format) to HTML.
This is a simplified converter. For production, use a library
like 'striprtf' or 'pylibreoffice'.
"""
# Remove RTF control sequences
html = re.sub(r'\\\*?[a-z]+\d*[ ]?', '', rtf_content)
# Clean up curly braces
html = html.replace('{', '').replace('}', '')
# Convert formatting codes
replacements = {
r'\\b\s': '<strong>', # Bold start
r'\\b0': '</strong>', # Bold end
r'\\i\s': '<em>', # Italic start
r'\\i0': '</em>', # Italic end
r'\\par': '</p><p>', # Paragraph break
}
for Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.