Skip to content
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

How to create a Table? #42

Open
vonj opened this issue Sep 19, 2023 · 3 comments
Open

How to create a Table? #42

vonj opened this issue Sep 19, 2023 · 3 comments

Comments

@vonj
Copy link

vonj commented Sep 19, 2023

I don't understand how to use for instance DotMarkdown.MarkdownBaseWriter.WriteStartTableCell()

I get exceptions, like:

Cannot write 'TableCell' when state is 'Table'

How do I get out of that state? In what order should the methods be called?

@josefpihrt
Copy link
Owner

Hi,

You have to start with WriteStartTable:

  • WriteStartTable
    • WriteStartTableRow
      • WriteStartTableCell

This is not convenient way how to create markdown table.

Recommended approach is similar how XML document is created with System.Xml.Linq.XElement.

Extensive usage of this approach can be found here.

MTable type uses MarkdownWriter under the hood.

@vonj
Copy link
Author

vonj commented Sep 20, 2023

I will try this second method out tonight.

I got the first way working before you answered, but the table output was not what I expected.

@josefpihrt
Copy link
Owner

@vonj any progress?

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

No branches or pull requests

2 participants