chrisdevereux/Slash

Generate paragraph breaks for <p>

Opened this issue · 1 comments

I noticed that when passing text that looks like this:

<p>Paragraph 1</p><p>Paragraph 2</p>

The string you get back lumps both together. Ideally it should add "\n" at the end of both.

To generalize this and allow for other clever stuff such as line breaks (and not paragraph breaks) for
and potentially other custom tags, could you add support for adding an arbitrary string at the closing end of the tag?

For now I'm working around this by doing:

s = [s stringByReplacingOccurrencesOfString:@"</p>" withString:@"</p>\n"];

What's your use case here? This library is really intended to be a lightweight way of marking up NSAttributedStrings, where the tags map directly onto string attributes. If you want to parse/format HTML, Cocoa & Cocoa Touch (and other libraries) both have methods on NSAttributedString to do that. If you're consuming HTML (and can't change that), you'd probably be better off using one of those than trying to get this library to do that.

If not, why not just add the linebreaks to your input text?