Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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.

share|improve this question
    
Can you give an example of the things you've tried that have and haven't worked? –  Abby T. Miller Oct 10 '11 at 13:37
    
Added the examples. –  nathan Oct 11 '11 at 2:24
    
I can't answer your question, but I voted it up hoping someone else can....... –  Abby T. Miller Oct 11 '11 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 Oct 11 '11 at 5:39
1  
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 Oct 11 '11 at 13:31
add comment

2 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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