Code tags not working
-
I am trying to post source code in C#.NET or HTML as examples. I add them to my blogpost as described (by using [code] and [/code]). But every time I publish the post all characters normally used in HTML get altered to their escaped characters. Could this please be fixed?
The blog I need help with is: (visible only to logged in users)
-
Hi @dannyvanderkraan ,
I took a look, and your tags seem to be working here:
https://dannyvanderkraan.wordpress.com/2016/04/19/asp-net-core-1-0-goodbye-html-helpers-and-hello-taghelpers/If you are still having issues, please share more details, so I can try to help you out.
-
staff-zinnia look closer please. Those are all images except the 1st code block. In preview it works fine. I made images in preview you see. Then I replaced all wrong code blocks with images. It’s a big problem for me because i blog about software engineering.
-
I add them to my blogpost as described (by using [code] and [/code]
You need to use [code language="css"] and [/code] for posting source code.
See here, please:
https://en.support.wordpress.com/code/posting-source-code/ -
@galios First off, thank you for your reply. You are just trying to help, but… Don’t you think I know that? :) To be exact, you only need language if you want the highlighting for your specific language. So I use ‘csharp’ and ‘html’ (not css). And… It simply does not work. WordPress.com peeps need to fix something IMHO.
-
So I use ‘csharp’ and ‘html’ (not css)
It was just an example.
Did you read the article?
https://en.support.wordpress.com/code/posting-source-code/It works perfectly for posting source code for me ;)
P.S.: I’m Galois, not galios. ;)
-
See the scrteenshot:
https://cloudup.com/c_lqn_02oMBThose are all code, not images: It works!
-
-
@galois Sorry for typing your name wrong.
Having said that. Yes, I’ve read the article. That is why I told you about the language parameter. Do you know you don’t even need to set it? It defaults to ‘text’ and you won’t get nice highlighting.
I’ve also seen your screenshot and it works sometimes with me too. Try to save the blogpost, go to your stats page, then reopen the draft. Here, this is how it looks like with me when I did that with my draft:
[code language="html"] <img src="~/img/Ahi99Y3LN6EJRBeUu5NB49MAiG_42tnVdeRrYtvr5qNu.jpg" asp-append-version="true" /> [/code]See?
-
Huh? Wait a minute… Setting it here in the forum between backticks (‘) it actually looks good?? I mean… in my draft it looks like:
[code language="html"]
<img src="~/img/Ahi99Y3LN6EJRBeUu5NB49MAiG_42tnVdeRrYtvr5qNu.jpg" asp-append-version="true" />
[/code] -
Ok… Now it shows it correctly even between blockquotes?! I just made a screenshot then… This is what it looks like in my edit screen everytime I come back to my draft:
-
@dannyvanderkraan: code brakets are not for posting source code on WordPress.com
Again, if you want posting codes like csharp, you need to use code brakets with the language inside:
[code language="css"] and [/code]
[code language="html"] and [/code]
[code language="csharp"] and [/code]
etc.It’s all.
-
@galois Sorry but you are not making any sense to me right now? Have you looked at the two sample codes I posted? Have you looked at my screenshot? I am using code brakets with the language parameter inside. You seem to not have read that I wrote to you a couple of times now that I know perfectly well how the code brakets work?
Do you really want to help? Have you tried saving your HTML source code and then coming back to your draft later? Please do that and tell me if your HTML was still in tact.
@general: Could someone from WordPress.com please come in here and have a look? Would be much appreciated.
-
Sorry but you are not making any sense to me right now?
Ok, good luck.
P.S.: I tagged this thread with modlook tag for Staff assistance, despite your rude behavior.
Have you tried saving your HTML source code and then coming back to your draft later? Please do that and tell me if your HTML was still in tact.
P.S.2.: yes, my HTML is still intact. And the method of https://en.support.wordpress.com/code/posting-source-code/ works perfectly for me.
-
@galois Sorry you feel wronged by my reply. But you keep replying the same thing over and over. Thank you for tagging this thread (why can’t I do that by the way?). Again thank you for helping so far. Alas my code looks like the screenshot I posted from the edit screen. But I am glad it works for you.
-
Hi @dannyvanderkraan, you’re welcome to add tags to any thread. Add “modlook” if you need staff to take a look.
Which editor are you using? I couldn’t quite tell from your screenshot. We have the new blue editor at wordpress.com/post or wordpress.com/page , various desktop and mobile apps, and the wp-admin editor. And most of those have a Visual Editor as well as an HTML or Text editor — which are using?
Also are you pasting the code or just typing it in yourself?
-
Hi @supernovia, thank you for taking a look at my question.
I believe I am using the wp-admin editor, the HTML editor. I type it in myself, but typing/pasting has the same result. I’ve added a screenshot to clarify: https://cloudup.com/c3ebBDRQ8mG
The exact behaviour is:
– Type over/paste the code block I’ve posted a few replies back in a draft in the HTML editor of wp-admin;
– Save the draft and leave it by closing the window or something;
– Go back to wp-admin and look up the draft to edit it in the HTML editor
– Note the changes to the HTML codeHope this helps finding out what is wrong. Thank you.
-
Thanks @dannyvanderkraan, I can see from the screenshot you’re using wordpress.com/post . I did a little digging and found there is indeed a bug that does what you’re seeing, and they are working on a fix.
https://github.com/Automattic/wp-calypso/issues/1426I did notice this only happens when you switch to Visual mode, so one fix would be to add the code last, only in the HTML view.
You could also use the older editor in the meantime if you need to add code samples:
https://dannyvanderkraan.wordpress.com/wp-admin/edit.php -
@supernovia Ah excellent! Atleast it’s a known bug. Slowly getting there. Thank you for investigating.
As for Visual/HTML view. I only go to Visual view to add images. And I don’t experience the same behaviour as you describe. Doesn’t matter if I never leave the HTML view. Every time I reopen my Draft it changed my code samples.
The old editor is a workaround for now. I tested it and it leaves my code samples in tact.
Do you happen to have an ETA on the fix?
-
The old editor is a workaround for now. I tested it and it leaves my code samples in tact.
That is the reason why it works for me and not you.
I never use the new editor, but the classic.Cheers.
- The topic ‘Code tags not working’ is closed to new replies.