pharmaverse / pharmaverse/rtflite

Add rtf_rich_text() function for inline text formatting

Open
#41 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
13
Forks
0
Avg merge
9m
Merged PRs (30d)
5

Description

Summary

r2rtf provides rtf_rich_text() function for inline text formatting within table cells. This allows mixing different text styles (bold, italic, etc.) within a single cell.

Expected functionality

# r2rtf example
rtf_rich_text("Normal text {b Bold text} and {i italic text}")

Proposed Python equivalent

# Proposed rtflite implementation
rtf.rich_text("Normal text {b Bold text} and {i italic text}")

Minimal example

import rtflite as rtf
import polars as pl

df = pl.DataFrame({
    "Treatment": ["Placebo", "Drug A"],
    "Response": [
        rtf.rich_text("n=50 {b (75%)}"),
        rtf.rich_text("n=48 {b (92%)}")
    ]
})

doc = rtf.RTFDocument(df=df)
doc.write_rtf("rich_text_example.rtf")

Use case

Clinical reports often need mixed formatting within cells (e.g., "n=50 {b (75%)}" where the percentage is bold).

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how RTFDocument consumes DataFrame cell values. Use the examples to define the supported {b ...} and {i ...} inline syntax, then verify that mixed text is emitted correctly in an RTF table cell, including the clinical-report example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.