codeblock: customize the line number #484

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
6 participants

xuhdev commented Mar 15, 2012

When we need to explain a snippet of code, sometimes we would like to explain it line by line. In this way, we may want the line number to be customized.

For example, in this blog of mine, I explain a file line by line. Seems that currently the codeblock plugin could not do this, so I make this pull request to implement this.

Syntax becomes: {% codeblock [title] [lang:language] [url] [link text] [start_lnr:n] %}, where n is the starting line number. An example page is here, and the source of it is here.

If this pull request could be merged, I'll write an example to the codeblock plugin page on octopress.org.

qqshfox commented Mar 21, 2012

+1

@imathis imathis added a commit that referenced this pull request May 27, 2012

@imathis imathis Improvements to Code embedding features
1. Removed lots of duplication
2. Added warnings and fixed some dim regex
3. New: set a start line number for any code snippet
4. New: set a start, end, or range for include_code
5. New: added option to disable line numbers linenos:false

Fixes #478 #484
e16844a

imathis closed this in 5c9a470 May 27, 2012

Owner

imathis commented May 27, 2012

Hmm double commits. Odd. Thanks for the idea! I ended up refactoring a lot of stuff so I just did it a bit differently instead.

xuhdev commented May 27, 2012

@imathis I see the change. It is great. Would you write some documentation about this? Thanks.

Owner

imathis commented May 27, 2012

Yep, you can view the docs in the site branch. Not live on the site yet. though ->

xuhdev commented May 27, 2012

It looks nice. Thanks!

xuhdev commented May 27, 2012

@imathis
However, the header in code_block.rb is still not updated. See this line:

# {% codeblock [title] [url] [link text] %}

Should be changed to

#{% codeblock [title] [url] [link text] [lang:language] [start:n] %}

?

How can I do to work it after a year...?

It looks like this was merged into the migrator branch, which is now 600 commits ahead of master. I'll checkout the migrator branch soon and see if things still work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment