Resource-box badge label overflow or mid-word wrap
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in src/presentations/slides.py at add_resource_box_slide, especially the badge text-frame code around lines 443 and 488-498. Run the provided uv MRE and inspect the generated .pptx with the default badge settings. Done means long labels fit without mid-word wrapping while short labels remain unchanged, with the resource-box geometry unaffected.
Written by the indexing model from the issue text.
Description
Summary
On a resource-box slide, badge labels longer than ~6 characters wrap awkwardly inside the narrow fixed-width badge — e.g. "Presentations" breaks mid-word as "Presentat ions" and "Build and Govern" stacks onto three cramped lines.
Impact
High — any resource box with a label longer than ~6 characters is hard to read. Short labels are unaffected.
Environment
ms-presentationsversion: 0.1.6- Python version: 3.10+
- OS / version: reproduces on all (verified on Windows 11)
- Install method: pip / from source
- Relevant deps (if Azure path): n/a — renders fully locally, no Azure
- Azure / model config: n/a
Steps to Reproduce
- Author a
resource-boxslide with a box label longer than ~6 characters. - Keep the default
badge_width(0.9") andbadge_font_size(11). - Render and open the
.pptx.
Minimal Reproducible Example (MRE)
# /// script
# requires-python = ">=3.10"
# dependencies = ["ms-presentations==0.1.6"]
# ///
"""Self-contained MRE — resource-box badge label overflow / mid-word wrap.
Run with: uv run mse.py (no venv, no Azure, no network)
Long badge labels wrap mid-word inside the fixed 0.9" badge: "Presentations"
renders as "Presentat ions" and "Build and Govern" stacks onto three cramped
lines, while the short "Learn" label is fine. Open the rendered deck and compare
the three badges — the deck is the only output.
"""
import os
import tempfile
from presentations.cli import main
SPEC = """\
---
title: Repro - Badge label overflow
output: Badge_Label_Overflow.pptx
style:
badge_width: 0.9
badge_font_size: 11
---
## [resource-box] Getting started
**Subtitle**: Resources
**Box**: Learn
- Microsoft AI | https://learn.microsoft.com/ai/
**Box**: Build and Govern
- Azure AI Services | https://learn.microsoft.com/azure/ai-services/
**Box**: Presentations
- Samples | https://github.com/microsoft/presentations/samples
"""
with tempfile.TemporaryDirectory() as d:
spec_path = os.path.join(d, "minimal.spec.md")
with open(spec_path, "w", encoding="utf-8") as f:
f.write(SPEC)
main([spec_path, "-o", os.getcwd()]) # renders the deck into the PWD
uv run mse.py
Expected Behavior
Long labels shrink (or otherwise fit) the badge without breaking words mid-character.
Actual Behavior
"Presentations" wraps to "Presentat ions"; "Build and Govern" stacks onto three cramped lines; "Learn" renders cleanly — showing the problem is label length, not the box.
Additional Context
Root cause in add_resource_box_slide (src/presentations/slides.py:443, 488-498): the badge is a fixed 0.9"-wide rounded rectangle with word_wrap = True at 11 pt and no auto-fit, and python-pptx does not shrink text to fit. PowerPoint hard-wraps, including mid-word when a single word exceeds the box width.
Suggested fix: set text_frame.auto_size = MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE, paired with a deterministic font step-down for long labels (so the fit is correct even in renderers that don't recompute normAutofit). This touches only the badge text frame/font — no geometry — so it's independent of the other resource-box fixes.
- Dominant language
- Python
- Stars
- 10
- Forks
- 3
- Avg merge
- 24d 6h
- Merged PRs (30d)
- 1
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.
More from microsoft/presentations
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
microsoft/presentations#12 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/presentations#10 ·
-
Difficulty 2/5 Half a day Newbie friendliness 82/100
-
Difficulty 5/5 Over a week Newbie friendliness 48/100
microsoft/presentations#18 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/presentations#17 · 1 comment ·
All issues in microsoft/presentations
Similar issues
-
bug ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 Half a day Newbie friendliness 62/100
inmanta/inmanta-core#10835 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
sponsored
Difficulty 2/5 1-3 hours Newbie friendliness 65/100