auto detect source file mode

I reported an issue https://github.com/renard/o-blog/issues/69 a few hours ago,
and now I rewrite it if you want to use.