npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-asset-file-carp

v0.4.0

Published

让 hexo 适应 Typora 的图片引入编写习惯,而非调整习惯使用 hexo 的规则。

Downloads

7

Readme

hexo-asset-file-carp

针对文章和资源文件夹的相对位置来处理资源文件夹。Hexo 只提供了几个固定的 asset 文件夹设置,与平常编写习惯不同,所有要让 hexo 适应 Typora 的图片引入编写习惯,而非调整习惯去使用 hexo。

使用须知

资源文件夹解决方案:

  • 一、默认你的资源文件夹{asset_dir}在文章的同目录下,使用相对路径,例如

    └── source
      └── _posts
        └── hexo
          ├── assets
          │ └── filename.jpg
          └── hexo.md
  • 二、在编译后,默认将资源文件夹放到对应文章的相对路径下,例如:

    └── public
      └── 2023
        └── 9
          └── 5
            └── hexo
              ├── assets
              │ └── filename.jpg
              └── index.html
  • 三、对于像视频、音频等引用路径,hexo默认是不修改的,只要你的文件在资源文件夹中,就会随着资源文件夹一起复制过去,默认放到相对于生成后的文章文件的相对路径。

  • 四、对于本地的绝对路径文件、网络文件不处理,仅处理在 _config.yml 中定义的 asset_dir

  • 五、对于上级目录的资源文件使用相对路径引用,如 ../<filename>.jpg,不做二次处理,仅处理 ./,如果你这样 ./../<filename>.jpg 编写,处理之后,文件不显示,自负。

使用

在 hexo 项目的根目录下执行:

npm install hexo-asset-file-carp --save

配置

修改 _config.yml

post_asset_folder: true
asset_dir: ./assets

post_asset_folderHexo 官方提供的一项配置,当它的值为 true ,会在新建文章时,在同目录下创建一个与文章名一致的资源文件夹。

asset_dir 则是我自定义的一项配置,根据 Typora 的配置规则来,你可以设置 ./assets./${filename}.assets./${filename} 或者其它的,${filename} 会被解析成文章的文件名,而不是在 Front-matter 中设置的 title。不建议设置成 ./ ,我没有做过滤,会把文章目录下的所有文件夹一起复制过去,包括文章 .md 文件。