10

I post using Tumblr's markdown support. I've tried embedding my gist snippets as links, etc. but can't seem to figure out the right combination. If I post using html, the gist links work fine. I would rather use markdown, how can I do this?

Updated with examples

I tried it with a basic embedded script tag, which didn't produce anything.

<script src="https://gist.github.com/1256020.js?file=gistfile1.rb"></script>

I also tried it with a reference to the script tag

[gist][1] 
.
.
.
[1][<script src="https://gist.github.com/1256020.js?file=gistfile1.rb"></script>]

I also tried other variations of embedding the hyperlink but nothing would show up on the page.

5
  • Can you give an example of the things you've tried that have and haven't worked?
    – hairboat
    Commented Oct 10, 2011 at 13:37
  • Added the examples.
    – nathan
    Commented Oct 11, 2011 at 2:24
  • I can't answer your question, but I voted it up hoping someone else can.......
    – hairboat
    Commented Oct 11, 2011 at 3:02
  • 2
    The mantra is "For any markup that is not covered by Markdown’s syntax, you simply use HTML itself." In other words, other than a simple embed what you are asking for is not possible. Markdown is not to be confused with short tags.
    – phwd
    Commented Oct 11, 2011 at 5:39
  • 2
    phwd, thanks for the response. I understand that it may not be possible in Markdown as a parser. However, some sites, like Github's gist, provide Markdown extensions for additional capabilities. I was hoping that Tumblr would do the same and I was just missing the syntax.
    – nathan
    Commented Oct 11, 2011 at 13:31

2 Answers 2

1

It seems the real problem lies in the fact that embedded scripts are ignored in posts, most likely for security issues.

But it is possible to load JS within the description field when you go to "Customize your blog" (Kind of defeats the previous statement)

So you may be able to use a JS library (I think Write Capture might help) that allows you to write Javascript to specific parts of the document and use a parser to search and replace for phrases for example

[gist 1256020]
<div class="gistr">1256020</div>

Then you use a parser to deal with it. Or wrap Gist IDs in div element with say a class, iterate through all elements with that class and replace the id with the Gist using the Write Capture function So as you can see... it ends up going into a programming problem which is outside the scope of this site.

0

As an updated answer, I recently created a new version of embedgist.js to simplify gist embedding in your blog. You can find my article about it here:

http://blog.johnryding.com/post/76489062311/embedding-gists-and-enable-code-syntax-highlighting-in

Basically, you have to add some script tags to your blog's template.

With this change, instead of having special HTML in your post, you just have to add a URL to the gist you wish to embed. For example, you just have to put the following in your post's content for a gist to get embedded:

https://gist.github.com/strife25/8967034#file-embedgist2-js

This technique works in Tumblr's markdown editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.