Could you add the plugins that allow for source code formatting in Wordpress so that languages such as Java will be correctly displayed and formatted?
thanks
Need help? Check out our Support site, then
Could you add the plugins that allow for source code formatting in Wordpress so that languages such as Java will be correctly displayed and formatted?
thanks
Two of the of the most common questions that volunteers on the wordpress.com support forum answer every day are: "How do I edit the wordpress.com template?" "Why does javascript get stripped?"
The answer is: I'm sorry but you cannot edit your template and you cannot use javascript. It's important to tell you that although some themes at wordpress.org and wordpress.com may appear to be the same they are not; the software is different.
At wordpress.com we are on a shared multiuser blogging platform and we are not allowed to alter our templates for security reasons. For the same reason we cannot use javascript, iframes, forms, some media embeds and styles, etc. http://faq.wordpress.com/2006/05/07/javascript-can-i-use-that-on-my-blog/
This explains is greater detail why javascript is stripped.
If you do not wish to use one of the themes made available at wordpress.com through your admin section -> Dashboard -> Presentation -> Themes then you have two options. The choice you make may depend on the differences between css customizing a wordpress.com theme or moving to self hosting or a web host and altering a free wordpress.org template.
(1) The "please read me first before posting" pink sticky at the head of the forum outlines the differences between wordpress.com blogs and wordpress.org blogs which are on different code bases.
(2) The 15$ you pay to upgrade enables you to to alter the appearance of your theme and but not the underlying php code. Purchasing the upgrade entitles you to customize a cascading style sheet on one blog for one year.
Specifically the CSS Editor does not let you edit any particular theme stylesheet; rather, it keeps the theme intact and lets you edit a brand new stylesheet. Because your custom CSS is loaded after the theme's CSS, your style rules can override or add to the existing rules.
You can use CSS to improve on any existing theme; you can define your own classes for use in posts; you can select the Sandbox theme and build on one of the Minimalist layouts or opt for no stylesheet and do it all yourself. If you decide to upgrade and undertake css customization these two threads may be helpful.
And as you are new to wordpress.com this thread will be useful to you because it contains links to the basic resources we use here. Happy Blogging!
georgesb,
in case of 'moving to self hosting', you'll, probably, might be interested in something like "Code Markup: a WordPress plugin" or "Highlight.js / WordPress plugin".
there're (rather due than convenient) quick-and-dirty tricks to PREserve a source code text markup (indents) on wp.com:
* one is to embed a code snippet into the <pre> HTML element;
* another (slightly more dirtier) is to use a multy-line <textarea> element with a readonly attribute set to "readonly".
Actually I think the top two questions asked around here are teh javascript one and the adsense one. :)
I think you guys might've misunderstood georgesb. To me, he wasn't asking how to use Java or JavaScript, but how to make the code display properly, like I'm doing it on my blog
If I'm correct, then what you, georgesb, need to do when writing a post is to click on the code tab and you should see a [code] button. Use it to display your code the way you want.
Finally, just a small clarification for those of you who don't know or might get confused with these names, Java and JavaScript are two different things. The former is a programming language, the latter is a scripting language :)
Thanks for your answers. What I wanted was to properly display some Java code for some of my high school students. I've using a blogger blog where I post a scratchpad of Java ideas we discuss in class. You can see it at http://javascratchpad.blogspot.com
I was thinking of using WordPress instead but it always seems to strip all the code that comes after the "<" symbol even when I use code tags. I think my best bet might be to self-host a Wordpress blog and use one of the plug-ins suggested by "options" above. Again, thanks everyone for your help.`
I hate [code]
Doesn't format the code.
I have to have everything in 1 block.
I think devblog uses <pre> tags, and not code tags. And they seem to work better (but still got to format the code yourself)
I wouldn't mind Code Markup to be added to the list of plugins... But I guess I will have to shift to a hosted setup sometime...
in order to post code, in addition to putting everything in <code> or <pre> tags, you'll need to replace any brackets with their HTML values, < and > respectively.
i find the easiest way to do this is to just past the code into the rich text editor, and switch over to the code tab to add <code> tags.
Regarding the post by devblog above, I've found one theme that converts
code tagged with the pre tag to look the way code looks on:
http://devblog.wordpress.com/2006/05/25/las-propiedades-textcontent-e-innertext/
but the code tag doesn't look like that. The problems are that it only works that way on one theme, on the others it just puts in out there and either gets chopped off short or goes off the right side of the page.
Also, from what I've seen, it seems to be deleting portions of the code.`
I would love to see a list of themes that properly support the code tag!
The most comprehensize theme review for wordpress.com themes are located here on engtech's site:
http://engtech.wordpress.com/tools/wordpress/wordpress-theme-reviews/
Not sure offhand if they have what you need but it's a great resource when these questions pop-up.
Anyone else love to see Nerdfusion write up a list of themes that properly support the code tag? :)
It's Open Source software. The person who suggests the idea gets to code it. ;)
I would be happy to modify an existing theme to properly (in my opinion) support the code tag, if it would then become a publicly available wordpress.com theme.
And by properly, I mean that it would use a fixed width font, and horizontal scrolling for long lines, instead of wrapping. I'm no designer though, so I don't want to take on the daunting task of creating an all new theme.
As far as the write up: I'm mentioning the problem, and my offer to help, here. And yes, I tried them all.
@timethief: It would help if you read the question before you did your copy and paste. This is quite a frequent occurence.
@root
I'm not a techy type so when I read the question I assumed the OP's mention of java meant javascript and that he or she wanted to edit the theme. In fact it wasn't until devblog chimed in that I understood that I was off track. Also the alleged frequency of misunderstandings occurring on the forum is not your concern. If Staff or Moderators are concerned making corrections is their role.
@timethief: The question refers to the formatting of Java. Your answer deals extensively with JavaScript. Different thing entirely. There was no mention of editing the template at all. Nor any requirement to do so. You say you are not a techie. That being so, no answer at all might have been a lot more useful than one which not only confused the OP but also every one else who might have a similar question and was reviewing this thread - having searched - as they are frequently asked to do.
Did you need help with something Janette88?
Fed up with the restriction of not being able to edit the CSS, and not being able to post an iFrame so that I could accomplish the same goal, I decided to take my blog elsewhere. I then promptly edited the CSS, and if anyone is wondering what proper code support looks like, feel free to check out my CSS [link broken - drmike].
You're running the regular version of wordpress now. There is a difference. You're the only one putting your blog at risk when you modify files now, not everybody else.
Looks the same to me actually.
So when are you going to write up that list of themes that support the code tag? I thought you offered to help.
@drmike - I'm not sure what you mean about putting my blog at risk. Please elaborate.
And in response to, "Looks the same to me actually" - look specifically at the code blocks on this post. It scrolls beautifully in Firefox, but I had forgotten to check it in IE until just now... where it also happens to scroll - though it's not as pretty as it could be. (Even in IE6!)
There are a few themes that do support the code tag, but thats not what my focus was - it was to find a theme that facilitated posting blocks of code. And if you followed the link I provided when I made my offer, you'll notice that I tried every theme available and none of them do it right. So there's your list: none.
And to top it all off, I did offer to help but wasn't even acknowledged. Why should I put time and effort into something that you made no attempt to inform me would be appreciated?
It's not a good idea to predicate your self-esteem on guarantees of appreciation from technical help forums.
All the people who post in this forum are bloggers just trying to help out. Maybe we do it because we're crazy, but some of us do it simply because we think helping out is a good thing to do. If you don't think so, nobody is going to force you.
We are crazy... yes we are ;) In terms of 'properly' supporting the code tag, I would imagine that the CSS upgrade should be able to 'fine tune' the look of how it displays text, but if you moved already, it would be kind of irrelavant. In terms of the offering help, it is all about 'what is in your heart' I guess! :) It is strange how code is displayed in the same theme on self-hosted though. Hmm.....
Trent
It's also not a good idea to invest time and effort into something that has zero chance of coming to fruition. I was merely stating that I wasn't going to waste my time if my changes weren't somehow made available to me for free. And when that didn't happen, *gasp* ... I made it happen for myself, for free, by moving.
The whole benefit of putting my blog here was that it was free and easy to set up. Even easier than installing a second copy on my own webserver, where I was already running 1 copy of Wordpress. When I found out that a feature I wanted wasn't available (for free) I offered to make it. When nobody accepted that offer, I left. I don't see why you're so offended.
As far as the CSS upgrade (trent) - I suppose that's nice for people who don't pay for a server and domain otherwise, but for me it would be a frivolous expense. If anyone does happen to come across this thread and desire what I did, I invite you to follow the links I've posted - because I accomplished my goal, and the CSS is there for the taking.
Trent - I'm not exactly sure what you're getting at, but I think you're comparing how my code blocks are displayed here versus on my own hosted copy. That's because I am, *gasp again!*, using the same theme... but I took the liberty of editing the CSS.
Sorry again for not wanting to waste my money for something that should be free to begin with!
I understand what you are getting at, but really I don't think anyone here is trying to start any drama here :) If the theme isn't displaying the code the way you want by default, it is worth a feedback into the staff about it since they control the backend templates and CSS by default. Trashing why it doesn't work here really won't get you the desired results. I just mentioned that the CSS upgrade would fix it (which it would) and understand that if you have your own server, that isn't worth it to you! Either way, it looks good on your self-hosted blog and that is what counts! Cheers for that!
Trent
The OP has a point here. A good theme would cover all the bases in typography - address, cite, code, q, etc. But a lot of them simply omit half the necessary CSS. And many of those same themes end up here. For a fanatical techie community like bloggers; code formatting should be a no brainer. As to how a guy could be *putting his blog at risk* by editing his own CSS God alone knows. This forum is going from bad to worse.
Can something be done about the autoformatting done to code tags in the editor? If you put code tags around a section with multiple line breaks, the code tag is stripped from all but the first blocks of text.
thanks!
Are you using the editor tab or the code tab when you are adding them?
Trent
Yeah better support for code-blocks would be a great feature.... I have tried preformatted and the code tags but nothing works just right. Preformatted still changes the quotation marks while code breaks in between multiple line breaks (via the code tab dunno how to add code tags from the editor).
Well, wordpress.com added support for sourcecode tag a few weeks ago.
http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/
This topic has been closed to new replies.