Markdown syntax for interactive shell commands

5,616 views
Skip to first unread message

Bruno Parmentier

unread,
Jan 6, 2015, 2:07:26 PM1/6/15
to nikola-...@googlegroups.com
Hi,

I'm not sure if I should post here or if it is more a Markdown problem.

I would like to display code blocks with syntax highlighting for interactive shell commands. If I start my command with $ (user command) syntax is okay, but if I start with # (root command) the line is considered as a comment.

Is there a special Markdown "flavor" for interactive shell or should I use html directly? (maybe even adding $ or # with CSS)

Regards,
Bruno Parmentier <http://www.brunoparmentier.be>

Chris Warrick

unread,
Jan 9, 2015, 7:59:34 AM1/9/15
to Nikola—Discuss

What syntax are you using, exactly? How do you mark the code blocks? # should never cause deletion, AFAIK.

--
Chris Warrick <https://chriswarrick.com/>
Sent from my Galaxy S3.

--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bruno Parmentier

unread,
Jan 10, 2015, 7:18:14 AM1/10/15
to nikola-...@googlegroups.com
I use ``` to mark de blocks (sometimes ```bash or ```sh but that doesn't really change anything). Maybe I expressed myself poorly, the lines begining with # are not deleted, but highlighted as comment in the html output.
For example: http://www.brunoparmentier.be/blog/configure-ntp.html. Command with $ is okay, the one with # is not what I want.

Bruno Parmentier <http://www.brunoparmentier.be>

Chris Warrick

unread,
Jan 10, 2015, 7:26:39 AM1/10/15
to Nikola—Discuss
On Sat, Jan 10, 2015 at 1:18 PM, Bruno Parmentier
<bruno.pa...@gmail.com> wrote:
> I use ``` to mark de blocks (sometimes ```bash or ```sh but that doesn't
> really change anything). Maybe I expressed myself poorly, the lines begining
> with # are not deleted, but highlighted as comment in the html output.
> For example: http://www.brunoparmentier.be/blog/configure-ntp.html. Command
> with $ is okay, the one with # is not what I want.
>
> Bruno Parmentier <http://www.brunoparmentier.be>

This is correct behavior. In bash, the # character signifies a
comment. However, if you use ```console instead, you will get
formatting suitable for a shell session.

Also, over here an empty ``` with no language specified does not color
anything. Your post uses ```bash for the # and $ blocks.

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Bruno Parmentier

unread,
Jan 10, 2015, 10:39:27 AM1/10/15
to nikola-...@googlegroups.com
That's it! ```console is what I was looking for. But where is it documented?

Thanks!

Bruno Parmentier <http://www.brunoparmentier.be>

Chris Warrick

unread,
Jan 10, 2015, 11:13:29 AM1/10/15
to Nikola—Discuss
On Sat, Jan 10, 2015 at 4:39 PM, Bruno Parmentier
<bruno.pa...@gmail.com> wrote:
> That's it! ```console is what I was looking for. But where is it documented?
>
> Thanks!
>
> Bruno Parmentier <http://www.brunoparmentier.be>

http://pygments.org/docs/lexers/#pygments.lexers.shell.BashSessionLexer
Reply all
Reply to author
Forward
0 new messages