Repository navigation
fix(jsii-pacmak): Python target crashes on h5 and h6 Markdown headings - #5292
Open
Thanatos9404 wants to merge 1 commit into
Open
Thanatos9404 wants to merge 1 commit into
Thanatos9404 wants to merge 1 commit into
Conversation
md2rst picks a reStructuredText underline character for each heading level from a list that only had four entries. A level 5 or 6 heading in a doc comment therefore threw "TypeError: Cannot read properties of undefined (reading 'repeat')", and jsii-pacmak failed to generate the Python package. Add underline characters for levels 5 and 6. Output for levels 1 to 4 does not change. Fixes aws#4418
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A level 5 or 6 Markdown heading (
#####or######) in a doc comment makes jsii-pacmak fail when it generates the Python package, withTypeError: Cannot read properties of undefined (reading 'repeat').md2rstlooks up an underline character for each heading level in a list with only four entries, so levels 5 and 6 read past the end. Only the Python target usesmd2rst.This adds
~and+for levels 5 and 6. Output for levels 1 to 4 doesn't change.Tests: added a
level %d headingcase for levels 1 to 6 totest/python.test.ts. Onmainlevels 5 and 6 fail with the TypeError, and with this change all six pass.Side note: the underline never actually shows up in the output at any level, because
textOf(node)is empty for heading nodes. I left that alone so existing docstrings don't change.Fixes #4418
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.