Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Make it possible to supply a filename for highlighted code #445
This patch makes it possible to supply a filename (or any arbitrary string for that matter) after the shebang line and it will be added to the generated code block.
You can see it in action here (search for settings.py):
I've inherited pygments.HtmlFormatter in order to get it working quickly but maybe we'd want this to go straight into pygments. Let me know how you want to proceed. The CSS that goes with this change is as follows:
added a commit
this pull request
Nov 26, 2015
Thank you for your contribution. However, I'm unsure about this. I never understood the desire to pull the code blocks in from external pages. Why not just include the code in the document? Regardless, what is clear is that if such a feature were to be added, it should be part of #334 (see this comment). And that won't happen until version 3.0 is released; when all extensions will be broken out of the main lib and maintained separately (see the roadmap). In fact, we are in a feature freeze until the 3.0 release anyway. Therefore, I am closing this at this time. Feel free to bring this up when the extension gets its own repo.
Hi @waylan ,
What I'm proposing is an additional text string, which can be used to indicate the file name (or anything really) being displayed. It's like a title for the code block.
Btw I'd prefer if you leave this issue open and I will take care of it once the extensions are broken out into a separate repository.
Just for reference, the Pygments part is here:
Oh you want a title. Completely missed that. Also missed the fact that this requires upstream support. Given the later, this is definitely a no. No need to open a new issue (or reopen this one) as #334 should provide a way to accept any arbitrary keyword which is accepted by Pygments. In other words, Markdown should no longer need to have each keyword hardcoded for it to work.