Inline Gist

73 views
Skip to first unread message

Michael Rabbitt

unread,
Jan 21, 2013, 2:35:50 PM1/21/13
to nikola-...@googlegroups.com
Hi.  I've started using Nikola recently and have been mostly been using embedded Gists for code samples on my blog.  I've been happy with this, except that nothing shows up for the code samples in the RSS feed or if viewed with JavaScript disabled, since embedded Gists rely on JavaScript.

It would be cool if the code for Gists could be fetched from Github at build time, and then include them into the generated HTML (perhaps in a <noscript/> tag).  Any suggestions where to start if I wanted to implement such functionality in Nikola?  Could this be done as a Task Plugin?

Thanks!

Michael

Roberto Alsina

unread,
Jan 21, 2013, 5:49:28 PM1/21/13
to nikola-...@googlegroups.com
And of course, there is a gist directive already :-)

Available as a gist (of course) here:


So, it would be a matter of adding it in the compile_rest plugin, and registering the directive like the others. Except that, of course, since it's github, it has no license information.

So, if you could contact the author, and ask for a license, adding it in the module, etc, then it's not all that much work.

Roberto Alsina

unread,
Jan 22, 2013, 12:34:26 PM1/22/13
to nikola-...@googlegroups.com
I mailed the author about the license. If there's no reply I'll just rewrite it.

Michael Rabbitt

unread,
Jan 22, 2013, 12:57:35 PM1/22/13
to nikola-...@googlegroups.com
Cool, thanks! I mainly use Markdown, so I was going to work on a Markdown extension with the same functionality.  I was experimenting last night with refactoring nikola.plugins.compile_markdown to make it easier to add custom Markdown extensions. I'll submit a pull request once I wrap that up. I should have some time later this week.

Roberto Alsina

unread,
Jan 22, 2013, 1:04:52 PM1/22/13
to nikola-...@googlegroups.com
On 22/01/13 14:57, Michael Rabbitt wrote:
Cool, thanks! I mainly use Markdown, so I was going to work on a Markdown extension with the same functionality.  I was experimenting last night with refactoring nikola.plugins.compile_markdown to make it easier to add custom Markdown extensions. I'll submit a pull request once I wrap that up. I should have some time later this week.


Sounds awesome :-)

Roberto Alsina

unread,
Jan 22, 2013, 7:20:14 PM1/22/13
to nikola-...@googlegroups.com
Gist support is now in master.

Just do

.. gist:: 2395294

And you get a nice chunk of code :-)
Reply all
Reply to author
Forward
0 new messages