You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
httpdomain renderer: block-scalar summary produces unpaired ** and literal asterisks in output #173
The httpdomain renderer wraps an operation's summary in ** without stripping it first. When the summary comes from a YAML block scalar the value ends in a newline, so the generated markup opens the strong marker on one line and closes it on the next. docutils can't pair it, and the reader sees literal ** on the rendered page.
This is a rendering defect, not just a warning: the asterisks are visible in the HTML output.
Minimal reproducer
spec.yml — note summary: |:
openapi: 3.0.3info:
title: Minimalversion: 1.0.0paths:
/thing:
get:
summary: | Get Thingresponses:
200:
description: A thing.
Changing the spec to a plain scalar, summary: Get Thing, makes the warning and the literal ** disappear. That's a viable workaround, but a block scalar is valid YAML for this field and shouldn't break rendering.
Expected
**Get Thing** rendered as strong text, with no warning, regardless of trailing whitespace in the source value.
Cause
sphinxcontrib/openapi/renderers/_httpdomain.py, line 284:
284: yieldf" **{operation['summary']}**"
With operation['summary'] == 'Get Thing\n' this yields:
**Get Thing
**
.strip() on the value before interpolation should be enough. Description fields don't have this problem because they go through the markup converter, which normalizes them; summary is interpolated directly.
Worth noting the old renderer handles the same spec without this warning, so it's specific to this renderer.
Happy to open a PR for the .strip() if you'd like.
Activity
[doc] Render the Jobs API spec with sphinxcontrib-openapi instead of …
[doc] Render the Jobs API spec with sphinxcontrib-openapi instead of …
Fix sphinx-contrib#173
[doc] Bump sphinxcontrib-openapi to 0.10.0 (#66957)