Enclose text of entire comment in tags?
I’m using the WP-Syntax plugin on my blog, which is working fine, but I’d like to make it easy for people who post code–so the text of their code/comment is automatically formatted.
I’d like to let users select the language of the code they are posting (php, csharp, css, whatever) from a drop-down list, or some other control (perhaps a series of buttons like this comment form uses).
When the uses selects the language from the list, the entire text in the comment form textarea is automatically surrounded in the tags required by the WP-Syntax plugin.
The WP-Synatx tags look like this:
<pre lang="php" line="1"> code here </pre>
It is assumed that the entire contents of each post is code. So it should be fairly simple to insert tags on each end of whatever is in the comment field.
Can someone point me to examples of how to do this? Other options? Existing Plugins?
- The topic ‘Enclose text of entire comment in tags?’ is closed to new replies.