pharmaverse / pharmaverse/rtflite
Add rtf_rich_text() function for inline text formatting
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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