Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

*bold* erm?


Go to End
Reply


10 Posts   1901 Views

Avatar
banal

Community Member, 901 Posts

21 July 2009 at 8:56pm

Edited: 21/07/2009 9:00pm

Have a look at this post where a very simple parser is explained: http://silverstripe.org/general-questions/show/260299
Or here for a slightly more complex parser: http://doc.silverstripe.com/doku.php?id=recipes:syntax-highlighting

But mind you, this won't be a simple task if you want to be sure you always end up having valid html. Probably the best approach would be to build some finite state machine that runs through the content and makes sure, opened tags get closed again...

Update: You could also write a custom method for this in the blog controller (like you mentioned in your previous post). The TextParser is a more generic approach though. TextParsers can be used on any "Text" or "HTMLText" Datafield.

Avatar
mhull

Community Member, 79 Posts

21 July 2009 at 9:34pm

banal, thank you for your comments but I think this is beyond my abilities.
I guess I assumed that something similar would have been done before, or that there would be some documentation somewhere that I couldn't find. I am surprised this hasn't been an issue for others who want limited content and styles/images etc.

For now I think I may be best using $Content.Summary(40)
which at least doesn't show asterisks, but won't allow the bold text to be shown when it appears in the content.

Go to Top