Enable syntax highlighting of code blocks (mostly ABNF)
Change-Id: Iaaf02dc02cc232518421fa3591004d2bb5939440
diff --git a/conf.py b/conf.py
index 8c7d7e3..4e67ed6 100644
--- a/conf.py
+++ b/conf.py
@@ -68,5 +68,5 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
-# Disable syntax highlighting.
-highlight_language = 'none'
+# Use ABNF syntax highlighting by default for code blocks.
+highlight_language = 'abnf'
diff --git a/name.rst b/name.rst
index a7f0fca..96a1c23 100644
--- a/name.rst
+++ b/name.rst
@@ -141,13 +141,15 @@
If one name is a proper prefix of the other, then it comes first.
.. note::
- The canonical order can be enforced by directly comparing the wire encoding of the ``Name`` field's TLV-VALUE (i.e., excluding TLV-TYPE and TLV-LEGNTH of the whole Name TLV)::
+ The canonical order can be enforced by directly comparing the wire encoding of the ``Name`` field's TLV-VALUE (i.e., excluding TLV-TYPE and TLV-LENGTH of the Name element itself):
- int
- canonicalOrder(Name lhs, Name rhs) {
- int result = memcmp(lhs.value(), rhs.value(), min(lhs.value_size(), rhs.value_size()));
- if (result == 0) {
- result = lhs.value_size() - rhs.value_size();
- }
- return result;
- }
+ .. code-block:: c
+
+ int canonicalOrder(Name lhs, Name rhs)
+ {
+ int result = memcmp(lhs.value(), rhs.value(), min(lhs.value_size(), rhs.value_size()));
+ if (result == 0) {
+ result = lhs.value_size() - rhs.value_size();
+ }
+ return result;
+ }
diff --git a/tlv.rst b/tlv.rst
index 969eb41..68e4130 100644
--- a/tlv.rst
+++ b/tlv.rst
@@ -84,7 +84,9 @@
- if the length is 4, the ``NonNegativeInteger`` is encoded in 4 octets, in network byte-order;
- if the length is 8, the ``NonNegativeInteger`` is encoded in 8 octets, in network byte-order.
-The following shows a few examples of TLVs that have a ``NonNegativeInteger`` as their value component in hexadecimal format (where ``TT`` represents the TLV-TYPE, followed by the TLV-LENGTH, and then the TLV-VALUE)::
+The following shows a few examples of TLVs that have a ``NonNegativeInteger`` as their value component in hexadecimal format (where ``TT`` represents the TLV-TYPE, followed by the TLV-LENGTH, and then the TLV-VALUE):
+
+.. code-block:: none
0 => TT0100
1 => TT0101
diff --git a/types.rst b/types.rst
index fc63fbf..be8070b 100644
--- a/types.rst
+++ b/types.rst
@@ -83,8 +83,8 @@
+---------------------------------------------+------------------+-----------------+
.. note::
- ABNF grammar of this specification denotes TLV-TYPE of element X as ``X-TYPE``.
- For example, ``INTEREST-TYPE`` means ``%x05``, the TLV-TYPE of ``Interest`` encoded in VAR-NUMBER-1 format.
+ The ABNF grammar of this specification denotes the TLV-TYPE of element ``X`` as ``X-TYPE``.
+ For example, ``INTEREST-TYPE`` means ``%x05``, the TLV-TYPE of ``Interest`` encoded in ``VAR-NUMBER-1`` format.
.. _type reservations: