hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.57k stars 4.86k forks source link

hexo publish draft.md don't look at the right filename + markdown extensions #1821

Open noraj opened 8 years ago

noraj commented 8 years ago

Hi,

I have a markdown file source/_drafts/install-ubuntu-from-usb-stick.mkd and I wanted to use the command hexo publish install-ubuntu-from-usb-stick.mkd to publish it in my source/_posts/ folder but I get the error :

hexo publish install-ubuntu-from-usb-stick.mkd                                                
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: Draft "install-ubuntu-from-usb-stick-mkd" does not exist.
    at /run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/hexo/post.js:197:22
    at tryCatcher (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:629:18)
    at Promise._resolveCallback (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:424:57)
    at Promise._settlePromiseFromHandler (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:515:17)
    at Promise._settlePromise (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:629:18)
    at Promise._resolveCallback (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:424:57)
    at ReductionPromiseArray._resolve (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/reduce.js:51:19)
    at Promise.completed [as _fulfillmentHandler0] (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/reduce.js:112:15)
    at Promise._settlePromise (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:557:21)
    at Promise._settlePromise0 (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Async._drainQueue (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:126:16)
    at Async._drainQueues (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:136:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

the same happened when I used hexo publish source/_drafts/install-ubuntu-from-usb-stick.mkd or with a markdown file with the .md extension.

As you can see at the line Error: Draft "install-ubuntu-from-usb-stick-mkd" does not exist. the something.mkd is transformed into something-mkd so the js lib doesn't find the file.

And I wanted to add that in the official doc, there is no article saying which template langage renderer extension we can use. We know that Hexo support markdown, but by reading the doc we don't know if we can only use .md extension or if .mkd or .markdown extensions are supported too. And of course there is nothing in _confi.yml to configure wich extensions are recognize or not. By reading the doc we now that markdown and html are rendered but we don't wich other lange are or not.

Say me if I can help to write docs or contributing in another way.

Best regards and thans for this great hexo static website generator :)

PS : sorry for my poor english

huguangju commented 8 years ago

@shark-oxi use hexo publish 'install-ubuntu-from-usb-stick' to publish you draft, no need file ext.

noraj commented 8 years ago

Fail :

Success :

But what happen is I have a file.html and a file.mkd and I do hexo publish file?

noraj commented 7 years ago

Stale block

NoahDragon commented 7 years ago

I think the hexo publish only seek the .md files. Have you tried the scenario you proposed?

But what happen is I have a file.html and a file.mkd and I dohexo publish file?

noraj commented 7 years ago

@NoahDragon This take the .html.

NoahDragon commented 7 years ago

@noraj1337 I think it is something needs to be fixed.