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 customise conversion of \r \n characters? #4

Open
roberttolton opened this issue May 21, 2018 · 2 comments
Open

How to customise conversion of \r \n characters? #4

roberttolton opened this issue May 21, 2018 · 2 comments
Assignees
Labels

Comments

@roberttolton
Copy link

Hi, is there a way to customise how \r\n\r\n characters are converted?

I'm looking to have \r\n\r\n become </p>\n\n<p> (wrapped in paragraph tags, first tag is last tag of previous paragraph for this example sequence).

Currently this package is producing <br/>\n<br/>\n and no paragraphs at all.

Even if I was able to turn-off the automatic <br> insertion and do it outside of this package, that would be ok.

@chriskonnertz
Copy link
Owner

Hello,

did you try to call the render method with the keepLinesparam set to false?
https://github.com/chriskonnertz/bbcode/blob/master/src/ChrisKonnertz/BBCode/BBCode.php#L141

@roberttolton
Copy link
Author

Hi @chriskonnertz , I did indeed try that.

I've managed to get pretty much what I need using this function I found:
https://gist.github.com/joshhartman/5381116

$this->autop($bbCode->render($image->description_en, true, false), true);

Maybe this will help someone with a similar issue. I think that function could be streamlined a bit for what I need, but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants