Skip to content

Convert AWS HTML documentation to Markdown docstrings - #993

Merged
stobrien89 merged 3 commits into
developfrom
python-docs-html-markdown
Nov 30, 2026
Merged

stobrien89 merged 3 commits into
developfrom
python-docs-html-markdown

Conversation

@stobrien89

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

The Python generator wrote AWS documentation into docstrings as raw HTML. This converts it to Markdown, without Pandoc, as asked on #981.

  • smithy_python._docs.html_to_markdown is a small converter on the stdlib HTMLParser. AWS docs use few tags: p, code, a, ul, li, b, i, note and important cover nearly all of them.
  • It applies to services with aws.api#service, like the Java generator. Other Smithy docs are CommonMark and stay as they are.
  • Output follows the Java generator's: - list items, Note: / Warning: sections for note / important, fullname dropped, and placeholders like <Region> kept as inline code. Text wraps at 72 columns and keeps code spans and list indents whole.

On 6,000 sampled AWS documentation strings, 99% match Pandoc's text apart from line breaks, and the rest differ only in layout (like Pandoc's curly-quote handling). No content is lost.

The features fixture now has HTML docs on the service and PutNote. The protocol test snapshots rewrap some plain-text docs that had hard line breaks, which matches the Java output.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@stobrien89
stobrien89 requested a review from a team as a code owner November 27, 2026 17:19
properly deserialize successful and error responses.
This operation has three possible return values: 1. A successful
response in the form of GreetingWithErrorsOutput 2. An InvalidGreeting
error. 3. A ComplexError error. Implementations must be able to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was more readable before in this case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

This example POST operation has no input and serializes a request
without a HTTP body.

These tests are to ensure we do not attach a body or related headers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should preserve and treat double linebreak as an intentional paragraph

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@stobrien89
stobrien89 merged commit 51c6349 into develop Nov 30, 2026
26 checks passed
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.

2 participants