Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better asset management #3974

Open
qzi opened this issue Dec 16, 2019 · 4 comments
Open

Better asset management #3974

qzi opened this issue Dec 16, 2019 · 4 comments

Comments

@qzi
Copy link

@qzi qzi commented Dec 16, 2019

Check List

Please check followings before submitting a new feature request.

  • I have already read Docs page
  • I have already searched existing issues

Feature Request

If I enabled the post_asset_folder in _config.yml of HEXO, it will always create a new asset folder after hexo new
but sometimes I just want to create a new post without asset, but the default behaviour will still create a asset blank folder to make my sources dirty and not useful
So I wish to add one more feature to control whether I need the asset folder.

More over I hope that Hexo can impove its default rendering of image reference to support a original markdown syntax

  1. Add a asset off parameter for the command hexo new to control AssetOff after enabling asset folder
  2. Improve the asset url management for the natural markdown phrasing

Image reference
Improve the url reference for three scenarios in just one go:

  1. Markdown preview in local
  2. Hexo s in local after rendering
  3. static web page in /public host in the github page
![Rest Client](my-favorite-extensions-for-visual-studio-code/rest-client.jpg)
![Rest Client](./my-favorite-extensions-for-visual-studio-code/rest-client.jpg)

Here is the sample generated by using the asset link
https://leonvision.online/technology/2019/12/16/my-favorite-extensions-for-visual-studio-code/
Asset Link for integration
https://liolok.github.io/zh-CN/How-to-Add-Image-to-Hexo-Blog-Post/

Others

@SukkaW

This comment has been minimized.

Copy link
Member

@SukkaW SukkaW commented Dec 23, 2019

Please describe Improve the url reference for three scenarios in just one go?

For example, what did you written and where did you placed your image files before, then what happened, and what do you want to write in your markdown file and achieve what then.

@SukkaW

This comment has been minimized.

Copy link
Member

@SukkaW SukkaW commented Dec 23, 2019

Let me guess.

_source/post/
2019-02-14-Test-Post.md
2019-02-14-Test-Post/
+-- Test-Image-1.png
+-- Test-Image-2.png
+-- Subdirectory/
|   +-- Test-Image-3.png
|   +-- Test-Image-4.png

And the post will be rendered in https://blog.example.com/2019-02-14-Test-Post/

./Test-Image-1.png and ./Test-Image-2.png works at post page because they are under same directory with index.html, but will not work at homepage.

But the problem is your NexT theme (and probably all of the theme) use post.content. Since every post will be only rendered for once, it is impossible to have different output for post.content at index and page.content for the post.

https://github.com/theme-next/hexo-theme-next/blob/master/layout/_macro/post.swig#L205
https://github.com/theme-next/hexo-theme-next/blob/master/layout/_macro/post.swig#L208

@SukkaW

This comment has been minimized.

Copy link
Member

@SukkaW SukkaW commented Dec 23, 2019

I have noticed hexo-renderer-marked has an option prependRoot. root will be prepended after this option is enabled. I am wondered if we could prepend post path as well.

https://github.com/hexojs/hexo-renderer-marked#Options

@qzi

This comment has been minimized.

Copy link
Author

@qzi qzi commented Dec 25, 2019

Please describe Improve the url reference for three scenarios in just one go?

For example, what did you written and where did you placed your image files before, then what happened, and what do you want to write in your markdown file and achieve what then.

Thanks for your reply, SukkaW.

Normally, we will refer the image in markdown syntax like below:

![Rest Client](my-favorite-extensions-for-visual-studio-code/rest-client.jpg)
![Rest Client](./my-favorite-extensions-for-visual-studio-code/rest-client.jpg)

but we can get the correct rendering result in local preview, but it can not render correctly after in local Hexo server and the same as it after we push it to the host online. I think every markdown syntax should be rendered correctly in three scenarios:

  1. local markdown preview without hexo server
  2. local markdown preview with hexo server
  3. online markdown rendering in host

that could make the writing naturally align the markdown syntax and rendering correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.