Skip to content

Blockquote elements error on rendering #2

@svdm

Description

@svdm

Trying to render a blockquote throws an exception right now:

user> (markdown->clj-pdf "> This is a quote")
java.lang.IllegalArgumentException: No matching field found: getLiteral for class org.commonmark.node.BlockQuote

The issue is that the :default case of the render method relies on .getLiteral on the parsed element. This works fine for code blocks etc, but blockquotes are parsed differently by commonmark-java. For this case it creates a BlockQuote containing one or more Paragraph nodes. The BlockQuote node itself has no .getLiteral implementation, hence the error.

Something like this seems to work, but I'm not familiar enough with this lib and clj-pdf to be sure it's entirely the right approach:

(defmethod render :BlockQuote
  [pdf-config node]
  (->> node
       (render-children* pdf-config)
       (wrap-paragraph pdf-config node)))

It also has the downside of using a plain :paragraph, which makes it hard to style quotes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions