Adding custom paragraph styles to the RTE

I just went through a mini documentation nightmare trying to simply add a custom css style for code segments on DocPlanet to the RTE block style drop down. It turned out to be simple to implement and hard to find, which seems to be the norm with TYPO3. Here is the solution that worked very good for me:

RTE.default.contentCSS = fileadmin/templates/main/rte-style.css
RTE.default.showTagFreeClasses = 1
RTE.default.proc.allowedClasses := addToList(code)

I tried to use single css style sheet for all styles but RTE just would not use the main style sheet. I am not certain of the cause so be aware of the fact that you probably need one special css style sheet that will be used for the sole purpose of providing custom css styles for the HTMLArea RTE.

The second line causes the styles to be shown in HTMLArea and the third makes them survive the parsing on the way to the DB so that they are not stripped.

You can see the result of this TSConfig on this very page. The grey block above exists due to the very TSConfig it contains. You did know this site is done in TYPO3 did you?

Your thoughts

No comments

Add comment

* - required field