Skip to content

Comments

Fix broken documentation for output method target parameter#770

Merged
lucemia merged 6 commits intomainfrom
copilot/fix-output-method-documentation
Oct 16, 2025
Merged

Fix broken documentation for output method target parameter#770
lucemia merged 6 commits intomainfrom
copilot/fix-output-method-documentation

Conversation

Copy link
Contributor

Copilot AI commented Oct 16, 2025

Problem

The documentation for the output method's target parameter was displaying with broken formatting on the generated documentation site. The parameter description was split across multiple lines with malformed text:

target: specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50\
        "with optional prefixes "pal-", "ntsc-" or "film-")

This made the documentation difficult to read and appeared as damaged text in both the Python docstrings and the rendered HTML documentation at https://livingbio.github.io/typed-ffmpeg/reference/ffmpeg/#ffmpeg.VideoStream.output.

Root Cause

The issue originated from the source data file (src/ffmpeg/common/cache/list/options.json) which contained a literal \n (backslash-n) character embedded in the help text. This represented a C-style string continuation from the original FFmpeg source code that was not being properly handled during code generation.

Solution

This PR implements a comprehensive fix with two components:

1. Immediate Fix

  • Corrected the malformed documentation in the generated file src/ffmpeg/dag/io/output_args.py
  • The target parameter description now appears on a single line as intended

2. Future-Proof Fix

Added a normalize_help_text Jinja2 filter to the code generation system (src/scripts/code_gen/gen.py) that:

  • Replaces literal \n sequences followed by whitespace and quotes with single spaces
  • Collapses multiple consecutive whitespace characters into single spaces
  • Ensures all help text is properly formatted on a single line

Updated the code generation templates (src/scripts/code_gen/templates/dag/io/_output.py.jinja and output_args.py.jinja) to apply this filter to all help text during generation.

Result

The documentation now correctly displays as:

target: specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")

Testing

  • ✅ Verified Python docstrings display correctly
  • ✅ Built documentation with mkdocs build --strict successfully
  • ✅ Confirmed HTML output shows proper single-line formatting
  • ✅ All linter checks (ruff) pass
  • ✅ Module imports and functionality work as expected

This fix ensures that both the current documentation and any future code generation will properly handle help text containing line breaks or C-style string continuations.

Original prompt

This section details on the original issue you should resolve

<issue_title>Documentation for "output" method is damaged</issue_title>
<issue_description>Documentation for output method is damaged.

See here:

https://livingbio.github.io/typed-ffmpeg/reference/ffmpeg/#ffmpeg.VideoStream.output

...and scroll down below the "Parameters" table.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #769


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: lucemia <432851+lucemia@users.noreply.github.com>
@lucemia lucemia marked this pull request as ready for review October 16, 2025 00:40
@lucemia lucemia self-requested a review October 16, 2025 00:41
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.24%. Comparing base (c1b4ba9) to head (e4e4d01).
⚠️ Report is 3 commits behind head on main.

❌ Your project status has failed because the head coverage (78.74%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #770      +/-   ##
==========================================
+ Coverage   78.74%   81.24%   +2.49%     
==========================================
  Files          51       78      +27     
  Lines        3331     4553    +1222     
==========================================
+ Hits         2623     3699    +1076     
- Misses        708      854     +146     
Flag Coverage Δ
3.10 78.74% <ø> (ø)
3.11 78.71% <ø> (ø)
3.12 78.71% <ø> (ø)
backend 78.74% <ø> (ø)
python 78.74% <ø> (ø)
python-3.10 88.05% <100.00%> (?)
scripts 88.05% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/ffmpeg/dag/io/output_args.py 100.00% <ø> (ø)
src/scripts/code_gen/gen.py 92.70% <100.00%> (ø)

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI and others added 3 commits October 16, 2025 00:46
Co-authored-by: lucemia <432851+lucemia@users.noreply.github.com>
Co-authored-by: lucemia <432851+lucemia@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix damaged documentation for output method Fix broken documentation for output method target parameter Oct 16, 2025
@lucemia lucemia merged commit 25c492f into main Oct 16, 2025
13 of 14 checks passed
@lucemia lucemia deleted the copilot/fix-output-method-documentation branch October 16, 2025 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation for "output" method is damaged

2 participants