5

On one of my answers, I provided an illustrative ASN.1 specification to accompany it.

However, I could not find the right language to use to make it "light up".

Does StackOverflow or SecuritySE apply any in-house grammars that could be used for this purpose, or is there a grammar ~comparable to ASN.1 in the library somewhere?

2
  • Creating the new tags syntax-highlighting technical requires at least 300 reputation. May 19, 2021 at 21:51
  • 3
    I have added the tag syntax-highlighting. (Not sure about the technical tag, but others may disagree.)
    – Anders
    May 20, 2021 at 12:07

1 Answer 1

3

There's no way to add color or anything fancy on this website, but you can use some basic markup, even in formatted code, by using <pre> instead of four leading spaces. Note that you may need to use HTML entities for common symbols (such as using &gt; instead of >). Example text showing a simple hello world program in C with the string italicized and all functions made bold:

#include <stdio.h>

int main(void)
{
    printf("Hello, world!\n");
    return 0;
}

This is done by using the following:

<pre>
#include &lt;stdio.h&gt;

int <b>main</b>(void)
{
    <b>printf</b>(<i>"Hello, world!\n"</i>);
    return 0;
}
</pre>

I've used this feature a few times, such as in this answer to provide bold, italics, and superscripts:

5.2    Parsing the message
The message and its padding must be parsed into N m-bit blocks.

5.2.1  SHA-1, SHA-224 and SHA-256
For SHA-1, SHA-224 and SHA-256, the message and its padding are parsed into N
512-bit blocks, M(1), M(2),..., M(N). Since the 512 bits of the input block may be
expressed as sixteen 32-bit words, the first 32 bits of message block i are
denoted M0(i), the next 32 bits are M1(i), and so on up to M15(i).

5.2.2  SHA-334, SHA-512, SHA-512/224 and SHA-512/256
For SHA-384, SHA-512, SHA-512/224 and SHA-512/256, the message and its padding are
parsed into N1024-bit blocks, M(1), M(2),..., M(N). Since the 1024 bits of the input
block may be expressed as sixteen 64-bit words, the first 64 bits of message block
i are denoted M0(i), the next 64 bits are M1(i), and so on up to M15(i).
1
  • 1
    Hah, that's a pretty zany and creative solution! It might even be helpful for highlighting particular portions of some code. May 22, 2021 at 0:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .