Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github markdown for block of code

The following code isn't formatting the stuff between the ``` as assembly code and I was wondering why. Thanks!

- here is an example of an appropriate input file


```
.text
main:
        la   $s0, A              # load variables A and B into registers
        lw   $s0, 0($s0)
        la   $s1, B
        lw   $s1, 0($s1)

        add  $s2, $s0, $s1       # calculate sum
        la   $s3, Sum            # assign result to Sum
        sw   $s2, 0($s3)

        sub  $s2, $s0, $s1       # calculate difference
        la   $s3, Diff           # assign result to Diff
        sw   $s2, 0($s3)
exit:
        li   $v0, 10             # system call to terminate program
        syscall                  # make call

.data
A:      .word   32
B:      .word   16
Sum:    .word    0
Diff:   .word    0
```

<h3>Output:</h3> a ASCII text file with the corresponding MIPS machine code. Here is the corresponding output file to the above input file
like image 413
Wang-Zhao-Liu Q Avatar asked Nov 09 '13 00:11

Wang-Zhao-Liu Q


2 Answers

For what it's worth, now (3 years after the question was asked), assembly seems to work like a charm

```assembly
.text
main:
        la   $s0, A              # load variables A and B into registers
        lw   $s0, 0($s0)
        la   $s1, B
        lw   $s1, 0($s1)
```
like image 84
alexo_o Avatar answered Nov 15 '22 12:11

alexo_o


Different markdown implementations may use different syntax highlighting strings.

Stackoverflow uses this javascript file: https://dev.sstatic.net/js/prettify-full.en.js

There is no support for assembly unfortunately.
According to this meta question the list of supported languages on stackexchange are:

"bsh", "c", "cc", "cpp", "cs", "csh",
"cyc", "cv", "htm", "html", "java",
"js", "m", "mxml", "perl", "pl", "pm",
"py", "rb", "sh", "xhtml", "xml", "xsl"

Github uses this yaml file: https://github.com/github/linguist/blob/master/lib/linguist/languages.yml The correct string is assembly

Discord: A list of languages can be found here: https://highlightjs.org/static/demo/ for Intel x86 the relevant code is x86asm

like image 31
FalcoGer Avatar answered Nov 15 '22 12:11

FalcoGer