Marking code blocks fragments bold / italic

+++ wheels [Mar 03 15 03:22 ]:

What about specifying the lines in the fence?

Some existing parsers, such as Python Markdown [1], use a “hl_lines” option after the language. Example:

The spec allows an “info string” after the initial backticks. The spec only mandates interpretation of the first word of this info string (which is used as the “language” of the code block). The rest is free form, and a renderer can do what it likes with this. So, nothing in the spec prevents you from writing a renderer that looks in the info string for something like hl_lines=3 and adds line numbers to the highlighted code.

Of course, there is a drawback to this “free form” idea, which comes out in the thread A problem for backtick code fences.

1 Like