[RESOLVED] Code Tags?
-
I have found that if I copy and paste sections of code, that it wraps it inside a box with colour coding, but are there actual tags that define that behaviour?
If I want to write something code-wise, I have to boot up another editor, write the code, then copy & paste that into the forums. It would be much easier if I could just wrap it with a tag... if there is one.
I presume it is the leading Tabs that it recognises, but you can't TAB in the editor on here.
-
@LeeC2202 Markdown format creates code tags when the line starts with four spaces
function () { }
-
@rappo Ah right... that's okay then, thank you for the info.
-
@LeeC2202 No problem! Here's a document containing the full syntax: https://daringfireball.net/projects/markdown/syntax. One additional code feature is inline code:
function () { }
. This is done by surrounding your inline text with ` (grave accent)
-
@rappo That markdown page is really useful, thank you for that. What does make things tricky is that it says about indenting with 4 spaces or a TAB, which of course is awkward in a webpage because TAB always shifts the control focus rather than adding a literal TAB into the mix.
You know how that page uses the pre and code tags, can you use them directly in a comment to wrap something if you've already pasted it in?
-
@LeeC2202 I can look into the tab functionality. As for the HTML blocks, I don't believe they're supported.
-
@rappo Honestly, it's not that much of a problem. People are used to TAB not working in comments, it's pretty much a web-wide thing.
For short code pieces, hitting SPACE 4 times on each line wouldn't be too much of a problem. Anything more than that I can write in Notepad++ and TAB it out in there.
I only asked because on some sites, where you have the image button, they also have a <code> button that creates a tag-pair to insert code into... like on GTAForums for instance. But it's easier for me to work with what the site can do, rather than you make changes for what is probably just one person's request.
-
@rappo Sorry to drag this one back out of the bin... it's just that I have discovered that as you explained, you can use the grave symbol to mark code
Like this
After using Gitter, I discovered that if you put three either side of a block of text, you get this.Line of code Another line of code One more line of code
So that means you can wrap a code block, after you have typed it into the editor... which is really cool and very useful.
Wasn't sure if you were aware that you could do that, so just thought I would mention it.