Skip to content

[Question] Custom renderer outside MarkDig possible? #871

@Seikilos

Description

@Seikilos

Hi,

due to a lack of documentation I am trying to create a simple PDF exporter and was playing around with deriving from RendererBase because I won't return a text writer, so I cannot use TextRenderBase like the HtmlRenderer does. (This is my assumption)

However, the signature of render base poses some questions for me:

public override object Render(MarkdownObject markdownObject)

I get a MarkdownObject and need to descend down to containers, etc but I am stuck.

Beside the fact that I haven't found a way for a hierarchical traversal yet, I stumbled upon MarkdownObject.IsContainerInline and MarkdownObject.IsContainerBlock, which are internal.

I assume that I misunderstand how to approach the traversal, but does the internal modifier on the method above makes it quite tricky to discern what to do?

I looked at the plain text and html renderers, I also looked at some forked Wpf Renderer but still am unsure on how to handle traversal that way without a text render output (otherwise I could somehow hijack the html renderer I assume.

Or would be actually using the Html renderer to get html be the best way? I could parse the resulting html into a tree and then continue my pdf export from html instead of markdown I assume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions