Code in the forums
-
To post code in the forums, you need to put four spaces before the line. It's a little klunky, so I will see about adding in some wrapper tags to do so automatically. For now, however, it's how it needs to be done.
Example:
-------------------------------| Housing List |------------------------------- Limbo.........................Cobalt Conference Room...............Tributary Staff Lounge..................Cobalt Newbie Room...................No one Theno's Closet................Thenomain | 5 Housing Builds On Grid |-------------------------------------------------- @create Housing Directory=10 &F.HEADER Housing Directory=[center(ansi(h, | Housing List |), 78, ansi(%va, -))] @VA Housing Directory=<COLOR YOUR WANT> &FIL.OWNABLE Housing Directory=hasattr(%0, ownable) @VB Housing Directory=#<YOUR HOUSING OBJECT> @Desc Housing Directory=[u(f.header)]%r[iter(filter(%vb/fil.ownable, search(type=room)), [ljust(name(%i0), 30, .)][if(hasattr(%i0, owner), name(get(%i0/owner)), No one)], , %r)]%r[u(f.footer)] &F.FOOTER Housing Directory=[ljust(ansi(h, | [words(filter(%vb/fil.ownable, search(type=room)))] Housing Builds On Grid |), 78, ansi(%va, -))] @set Housing Directory=INHERIT
-
Thank yooooooooouuuuiuuuiujjuuuujbchhh vghnvv
Thank you! Thank you!
-
Man, it appears I didn't even have to do any work. To get a code block, use three backticks (```) in the line before and after the code.
var str = "String", ind = 0;
&d.name me=Glitch
It will try to automatically determine language (not available for MU of course), but to specify, use: ```<language name>. For example: ```html
<div class="col-md-7"> <p>Foo</p> </div>
-
@Glitch said:
Man, it appears I didn't even have to do any work. To get a code block, use three backticks (```) in the line before and after the code.
Ooo that helps. I'd been using the space method. Being able to specify the language is excellent.
It will try to automatically determine language (not available for MU of course), but to specify, use: ```<language name>.
What system is it using for parsing? Might be fairly easy to add a recognizer and syntax highlighter for mushcode.
Or even a prettyprinter that puts it in expanded form.
-
Remarkable: https://github.com/jonschlinkert/remarkable
For syntax highlighting, looks like it uses: https://highlightjs.org/
Adding languages: http://highlightjs.readthedocs.org/en/latest/language-guide.html
-
Footnotes? ^1
Well isn't that interesting.
-
@Chime said:
Or even a prettyprinter that puts it in expanded form.
Pretty print would require a parse plugin of some variety for nodebb itself, whereas adding syntax highlighting shouldn't be as big of a deal. Though copy/paste spacing is preserved. So you could go to http://muxify.serverglitch.net/editor.html and paste compact form mushcode, explode it and then copy/paste the left pane results here:
@Desc Housing Directory= [u( f.header )] %r [iter( filter(%vb/fil.ownable, search(type=room)), [ljust( name(%i0), 30, . )] [if( hasattr(%i0, owner), name(get(%i0/owner)), No one )] , , %r )] %r [u( f.footer )] &F.FOOTER Housing Directory= [ljust( ansi(h, | [words( filter(%vb/fil.ownable, search(type=room)) )] Housing Builds On Grid |), 78, ansi(%va, -) )]
ETA: Or any other pretty printer you prefer, of course.