tumultous_rooster
tumultous_rooster

Reputation: 12550

How do I make inline code with Github flavored markdown?

I am very confused, since I have followed the gitub-flavored-markdown specifications:

Standard Markdown converts text with four spaces at the beginning of each line into a code block; GFM also supports fenced blocks. Just wrap your code in ``` and you won't need to indent it by four spaces.

So, if you look here you will see the problem with my markdown: the numbering is all insane.

My actual markdown is here, which looks fine to me.

What is it about GFM that would cause this issue with the numbering of the line -- is there some problem with my Markdown, or is there some way I can get rid of the numbering of the lines of code?

Thanks in advance.

update
With the help from the posters below, I've managed to remove the pesky line numbering problem. I still can't seem to make the scrollbars appear.

Upvotes: 1

Views: 2931

Answers (3)

Mark M
Mark M

Reputation: 113

you can try the fenced_code extension, which enables you to use GitHub-style code blocks:

```python
print 'Hello world!'
```

https://github.com/getpelican/pelican/issues/1238

Upvotes: 2

xworder
xworder

Reputation: 91

Here, pelican doesnt use GFM, instead it uses the python's markdown processor, syntax highlighting is done via pygments python module, which expects (I think) a slightly different convention. Have a look at http://docs.getpelican.com/en/3.1.1/getting_started.html#syntax-highlighting and try that and see if it works

Upvotes: 2

thewildandy
thewildandy

Reputation: 328

It seems to me that your problem lies with the markdown processor itself; the line numbers are just a side-effect. The problem is two-fold:

  1. The line numbers column is not wide enough for the numbers it contains -- this is why the spacing is messed up and after "10" your numbers begin to stack.

  2. The code part of the viewer is allowing long lines of code to wrap onto multiple lines instead of overflowing with a horizontal scrollbar as they should, so even if you add sufficient width to the line numbers column they will not actually line up with the corresponding line of code.

Both of these issues could be resolved with a bit of simple CSS, but this would be treating the symptoms rather than the cause. Instead, I'd urge you to look into why your markdown processor is misbehaving.

Out of interest, are you pre-processing your markdown or letting GitHub Pages handle it?

Upvotes: 2

Related Questions