Skip to main content
4 of 4
replaced http://meta.stackexchange.com/ with https://meta.stackexchange.com/

Highlighting inside code blocks?

I often find myself wanting to draw attention to a particular part of the contents of a code block. The italic and bold formatting is interpreted literally, so those don't work:

_italic_ *bold*

I understand that under most circumstances we want code blocks to show exactly what is represented, but it would be nice to have some sort of markup that does work inside code blocks, for example if I wanted to highlight ANSWER: 0 here:

; <<>> DiG 9.7.0-P1 <<>> @a.gtld-servers.net ns1.google.com a
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25337
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 4, ADDITIONAL: 4
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;ns1.google.com.            IN  A

;; AUTHORITY SECTION:
google.com.     172800  IN  NS  ns2.google.com.
google.com.     172800  IN  NS  ns1.google.com.
google.com.     172800  IN  NS  ns3.google.com.
google.com.     172800  IN  NS  ns4.google.com.

;; ADDITIONAL SECTION:
ns2.google.com.     172800  IN  A   216.239.34.10
ns1.google.com.     172800  IN  A   216.239.32.10
ns3.google.com.     172800  IN  A   216.239.36.10
ns4.google.com.     172800  IN  A   216.239.38.10

;; Query time: 137 msec
;; SERVER: 192.5.6.30#53(192.5.6.30)
;; WHEN: Thu Apr 14 13:27:58 2011
;; MSG SIZE  rcvd: 164

It would be nice to be able to use something like the language hinting to specify what text should be highlighted in the following code block:

<!-- highlight: "ANSWER: 0" -->
Cakemox
  • 25.8k
  • 14
  • 2