-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Tables rendered as such strip the next header #2466
Comments
This one's a doozy, and there's updates/modifications to this behavior. Since #2603, which was supposed to fix this issue this behavior shows up slightly differently. Basically, any Markdown document nodes that appear after a Table element gets rendered, will not be rendered. Example: ## Here is a section
|t1 | *t2* |
|----------|------|
| **r1c1** | r1c2 |
Some text
## Another Header
With More Stuff! turns into ## Here is a section
|t1 | *t2* |
|----------|------|
| **r1c1** | r1c2 | Story so far:
|
Update: It is my suspicion that a Renderer is not being called correctly, causing Walk() to lose place in the document.
m := goldmark.New(goldmark.WithExtensions(TFRegistryExtension))
reader := text.NewReader([]byte(tt.input))
doc := m.Parser().Parse(reader)
doc.Dump([]byte(tt.input), 0)
err := m.Renderer().Render(&out, []byte(tt.input), doc)
fmt.Println(out.String()) shows the parser correctly detects Table nodes, but the
table := tablewriter.NewWriter(writer) # this is our writer that we pass in alongside the Table node
table.SetHeader(header)
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
table.SetAutoFormatHeaders(false)
table.SetAutoMergeCells(false)
table.SetAutoWrapText(false)
table.SetReflowDuringAutoWrap(false)
table.AppendBulk(rows)
table.Render() # this is not a markdown renderer; it's just a table printer
this does enable subsequent Renderers to track the remainder of the doc again, although of course now we have some unwanted HTML output.
|
This pull request does a couple of things: - Implement a render function for each subset of Table - Expand the `tableRenderer` struct to hold state - initialize a separate Renderer for the table renderer, since the logic for cell rendering calls back into the outer renderer and trying to use the same renderer lost track of content. - add tests to reflect a table in the middle of a document to ensure text after the table continues to get rendered - ad an overall doc test that contains a table. PR using this change: pulumi/pulumi-sdwan#114 Fixes #2466
This issue has been addressed in PR #2632 and shipped in release v3.96.0. |
This PR automates docsgen for this provider's installation doc. Part of pulumi/home#3598. Similar to pulumi/pulumi-newrelic#890, this is probably blocked on pulumi/pulumi-terraform-bridge#2466 due to poor table rendering. Update: This is awaiting the latest bridge; the table is rendered nicely now: <img width="750" alt="Screenshot 2024-11-11 at 10 49 14 AM" src="https://github.com/user-attachments/assets/becb265c-0e7d-42ee-a89e-b1b49bd3127e"> - **first docsgen** - **Remove TF-specific headers and clean up top-level Description** - **Tweak regexp for header text matching** - **Remove note as well** - **Remove secrets warning**
What happened?
Trying to run
registry-docs
on any provider with a table element in theindex.md
results in missing headers.Example
Examples: pulumi-ise, pulumi-sdwan, pulumi-newrelic.
registryDocs: true
to.ci-mgmt.yaml
make ci-mgmt
make tfgen && make build_registry_docs
when it should be
Output of
pulumi about
n/a; bridge at tip of default branch.
Additional context
Possibly related: teekennedy/goldmark-markdown#19
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: