joakim / tent-flavored-markdown

Tent Flavored Markdown
2 stars 1 forks source link

Inline images #5

Open cuibonobo opened 10 years ago

cuibonobo commented 10 years ago

I'd like for there to be a way to specify inline images within an Essay post. At the moment we can certainly insert images using regular HTML img tags (unless they're filtered out), but the HTML tag doesn't allow us to use data Photo posts.

My first instinct is to try to use ![Alt text](i) (similar to regular Markdown) where i is the index of the post in the mentions array. My only doubt about using this method is that the index i can be a cause for confusion if reference style links are also permitted in TFM.

With reference style links, the following would be valid Markdown:

I get 10 times more traffic from [Google][1] than from
[Yahoo][2] or [MSN][3].

[1]: http://google.com/        "Google"
[2]: http://search.yahoo.com/  "Yahoo Search"
[3]: http://search.msn.com/    "MSN Search"

Since there's no way for an app to meaningfully distinguish between an index to the mentions array and a reference style link, I believe we'll have to choose one or the other.

bnb commented 10 years ago

An error in your typing, whether intentional or not, might actually solve the problem. You put ![Alt text](i), where i is the index. As you point out, in regular markdown, to use a markdown-indexed link you use double brackets, ![][], but perhaps we could use regular parentheses for the tent index. This would also be consistent with the way mentions work.

I just took a quick look at the docs, and it seems you use refs to link to other posts, not mentions. Am I missing something somewhere along the line? I'm a complete novice with this kind of thing. I can't really seem to find how refs are used though. Are there examples anywhere?

cuibonobo commented 10 years ago

Ah! Good eye! I suppose the link parser can look at the contents of the parentheses and determine if it's a URL or an index.

Regarding using mentions or refs, I took my language directly from the examples for mentions, but you might be right!

bnb commented 10 years ago

I would like to leave this open until we've got a solution in the README.md file.