adam-p / markdown-here

Google Chrome, Firefox, and Thunderbird extension that lets you write email in Markdown and render it before sending.
http://markdown-here.com
MIT License
59.65k stars 11.27k forks source link

Can I integrate it into my personal blog? #371

Open Voyager2718 opened 8 years ago

Voyager2718 commented 8 years ago

Hello, I suppose this is a plugin for browsers, isn't it? But I would like to use it in my personal blog, converting original text to markdown. Should I modify the source code or there's an API to do so? Thanks.

r2evans commented 8 years ago

(Not the dev, just offering a thought.) MDH should work well in just about any web-browser-based editor that supports rich/html, including gmail and (I'm told) ACE editors. But this is mostly for writing emails and (at times) comments. What I hear you saying is that you want to write a full blog in markdown. This sounds like more than just MDH.

The answer depends heavily on which blog software you're talking about. WordPress has markdown support, for instance. You can host a blog using static files (that are dynamically generated) using Jekyll.

Bottom line, take a look for your specific blog-hosting software to see what's native. Perhaps come back here with more info if you don't know where to look or can't find anything ... and if you have control over your blog content-management software, perhaps this is impetus enough to switch.

Voyager2718 commented 8 years ago

Well, actually I would like to use it in my personal blog on the right panel . If you click on some articles, it will show you plain text but not formatted markdown.

r2evans commented 8 years ago

I've not seen that content management system before. Is that published code or your personal code? Looks slick.

Bottom line, it looks as if the data is being queried from a database or a file-store. Regardless which one, all that MDH does is provide a translation from MD to HTML. There are two ways you might integrate into the blog process:

  1. When done editing the content in your editor (do you use a text editor or a web-based editor like ACE?), then translate the MD into static HTML and save the HTML (either into your database or file-store, whichever you are using). MDH is only a factor if you are using a web-based editor like ACE; if you are editing in an offline text editor, then MDH is not (really) a factor (and you could use something like pandoc or even cmark).
  2. When queried by the user, the saved MD file is translated on-the-fly for the user. This is a bit inefficient, since a static MD would be converted into a static HTML every time somebody reads your blog. (For example, Jekyll attempts to fix this inefficiency by converting from MD to HTML when you save and publish into a static website.)

I don't see what changes to MDH would be necessary to be able to incorporate into your blog process. Perhaps you could better spell out your process and where you think a web-based MDH process would provide the translation?

Voyager2718 commented 8 years ago

Actually it's me who wrote that.

r2evans commented 8 years ago

You really need to answer the question of "How are you editing the content of an entry?"

Voyager2718 commented 8 years ago

No, actually what I want was: I retrieve some markdown from the server, then markdown here should convert them into colored markdown.

r2evans commented 8 years ago

That may be shoe-horning MDH into a place it doesn't really fit, but I'm out of thoughts/suggestions and certainly lacking sufficiently-deep knowledge of MDH. Sorry I can't help.

Punt. @adam-p ?

beauraines commented 8 years ago

When you say

colored markdown

I'm assuming you mean formatted text, so that the right hand pane of your blog is actually formatted nicely.

You should checkout something like yaru22/angular-md

There are lots of Angular directives that will parse Markdown into HTML. That search string makes a pretty good Google search.

Voyager2718 commented 8 years ago

In fact, it works on http://markdown-here.com/. Because in its example, it shows that it can convert text in the left box in to formatted text in the right box.