MU Soapbox

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Muxify
    • Mustard

    Code in the forums

    MU Code
    4
    7
    2304
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Glitch
      Glitch last edited by

      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
      
      1 Reply Last reply Reply Quote 2
      • Cobalt
        Cobalt Tutorialist last edited by

        Thank yooooooooouuuuiuuuiujjuuuujbchhh vghnvv

        Thank you! Thank you!

        1 Reply Last reply Reply Quote 0
        • Glitch
          Glitch last edited by Glitch

          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>
          
          Chime 1 Reply Last reply Reply Quote 1
          • Chime
            Chime @Glitch last edited by

            @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.

            It is by will alone I set my mind in motion. It is by the juice of Coffea arabica that thoughts acquire speed, the table acquires stains, the stains become a warning. It is by will alone I set my mind in motion.

            Glitch 1 Reply Last reply Reply Quote 0
            • Glitch
              Glitch last edited by Glitch

              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

              1 Reply Last reply Reply Quote 0
              • Thenomain
                Thenomain last edited by Thenomain

                Footnotes? ^1

                Well isn't that interesting.

                “If you wish to make an apple pie from scratch, you must first invent the universe.”
                ― Carl Sagan, Cosmos

                1 Reply Last reply Reply Quote 0
                • Glitch
                  Glitch @Chime last edited by Glitch

                  @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.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post