Major Feature #13907
Feature #10208: Implement an API
Use BoC within RTE fields
Would be a cool feature :-)
Integration could be adopted from: http://typo3.org/extensions/repository/view/vjrtecodesnippets/current/i
#3 Updated by Michiel Roos over 8 years ago
Here is an example extension that is an adaptation of vjrtecodesnippets.
# include library includeLibs.rtecodehighlighter = EXT:rtecodehighlighter/class.user_rtecodehighlighter.php # configure parsing of the pre tag # if you like to change the tag name make sure to change the PageTSConfig as well lib.parseFunc_RTE.tags.pre = TEXT lib.parseFunc_RTE.tags.pre.current = 1 # set the user function lib.parseFunc_RTE.tags.pre.postUserFunc = user_rtecodehighlighter->highlight
// We need this to know where the linebreaks are. We can replace <br/> with
Please find the ext attached
An example can be found here: http://www.michielroos.com/test/
#5 Updated by Thomas Mayer over 4 years ago
I'm looking for this feature for a long time. In most cases I need to
- write few lines of code, then few lines of text and so on
- write code in the same line together with the text (e.g. a function name in a paragraph)
Pretty much the way we do it in the Typo3 forge. In both cases, it's not realistic to alternate between text and code content elements every time.
There has been an approach for RTE editing in the meantime (which also adds user elements to rte):
I did not test it yet, but it looks promising. Would it be possible to integrate that into the official extension?
If necessary and/or possible,
<.code> and <samp>
could be used.
#6 Updated by Felix Nagel about 4 years ago
- Priority changed from Could have to Won't have this time
This would be a nice new feature but needs contribution or sponsoring as I won't find any time soon to implement this myself.
Anyway, the described approach sounds nice and definitely is worth a deeper look.
#7 Updated by Thomas Mayer over 2 years ago
With some additional Typoscript, I was able to
- surround code snippets in RTE with new "tags"
- render the code with pre or code tag (whereas pre is for complete lines and code is for snippets in normal text, rendered in the same p tag)
In RTE, the text of a normal text content element looks like this:
blabla [code.bash]uname -r[/code] blabla. The next tag goes into two separate lines [pre.bash]dpkg -l linux* dpkg -l linux* | grep ii | grep 3.16[/pre] blabla.
With that concept applied, I can toggle languages for the highlighting, as well as pre/code tags (see attached screen shot).
Please let me know if you think that this could be applied to the extension itself. I could at least provide the TypoScript code I have written so far.