github markdown for block of code
Solution 1
Their 'linguist' engine for syntax highlighting only knows so many languages; it seems that assembly code is not amongst those, as I can't seem to see any samples in their linguist/samples directory.
It should still display as a code block in monospaced font, however, if it's between the ``` tags.
Solution 2
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)
```
Solution 3
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
letter Q
Updated on June 04, 2022Comments
-
letter Q almost 2 years
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