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

Feature Request: Possibility to emit NodeSeq instead of String #3

Open
chenkelmann opened this issue Jul 29, 2012 · 1 comment
Open
Assignees

Comments

@chenkelmann
Copy link
Owner

It should be possible to emit NodeSeq objects instead of only Strings when processing Markdown.

The best way to achieve this is to refactor the Decorator and make it more generic. This needs some slight changes to callbacks for some elements. With a more general Decorator any kind of output can be produced.

The problematic part: with inline xml/html and xml blocks it is possible to create markdown that would result in invalid XML (sticking to plain markdown syntax will always produce wellformed XML in Actuarius.)

How should this be handled?

Variant A: Invalid inline XML/HTML / XML blocks cause(s) processing to throw an Exception
Variant B: Invalid inline XML/HTML / XML blocks is wrapped in an "Unparsed" NodeSeq (This is a quite ugly solution, as a consumer of NodeSeq would generally assume that he gets valid XML)
Variant C: Add a callback for these cases to the Decorator and let the decorator decide.

I favor Variant C with a default implemenation for a NodeSeq Decorator that throws exceptions when encountering invalid XML and a default implementation for a String Decorator that just outputs what it gets (current behavior)

@ghost ghost assigned chenkelmann Jul 29, 2012
@dpp
Copy link

dpp commented Jul 29, 2012

What I currently do in Hoisted is to use Lift's Html5 parser to parse the code blocks. The Html5 parser is very, very forgiving and generally results in reasonable HTML. That combined with option C would lead to a good result.

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