Coder Social home page Coder Social logo

hexo-backlink's Introduction

Hexo-Backlink

License Language NPM Downloads NPM Version

GitHub issue custom search in repo GitHub Issues or Pull Requests

A plugin to convert backlink in .md file to in-site link.

Install

npm install hexo-backlink

configuration

Add backlink:true in _config.yml:

Check the settings in Obsidian as follow:

"Settings" -> "Files & Links" -> "New link format" , setting as "Relative path to file"
"Settings" -> "Files & Links" -> "Use [[Wiki links]]" , keeping it ON

Know-issue

  • Can not convert link include tags, it will ignore the tags. like:

    [[DemoMarkdownFile#Demo]] --<result equals>-> [[DemoMarkdownFile]]
    

TODO

  • [] Update the documents and make sure you can start from zero.
  • [] Change the project to typescript.
  • [] Try to do some integritions.

hexo-backlink's People

Contributors

cyrusky avatar tymon42 avatar afterglowu avatar

Stargazers

灵玉 avatar Jin Yao avatar a13ph avatar Toshihiko Chen avatar 李松宇 avatar 零一 avatar Yanguan avatar  avatar  avatar mffseal avatar foobell avatar Bing Wong avatar SamHou avatar  avatar

Watchers

 avatar

hexo-backlink's Issues

Plugin doesn't work,Please help me!

image
This is the link content of my post.
I have done the configuration of hexo-backlink,but it does not work for me. The version of hexo and npm are as follows:

hexo: 7.1.1
npm: 8.1.2

Some glitches: wikilink in code block, post not found, plugin load failed

It's a useful plugin and helps me a lot. I might never think of using Hexo's tag plugin {% post_link %} to implement such function.

I found 3 glitches while using this plugin, shown as below.

1. Wikilink in inline code and code blocks

The [[knapsack]] inside inline code and fenced code block are also converted to {% post_link %} by this plugin.

image

2. Post not found

The path seperator of Windows is '\', but tag plugin {% post_link %} requires '/', so I get a "Post not found" error:

image

Add the following code can fix this, but I'm not sure whether it's the "standard" way or not. (I never use js before, I'm new to it.)

if (path.sep === "\\") {
    each = each.replace(new RegExp("\\" + path.sep, "g"), "/");
}

3. Plugin load failed

Currently this plugin only works properly when I launch hexo s (or hexo g) in my hexo project's root directory.
If I launch hexo s in a sub directory (e.g. the source folder), then errors will occur:

PS D:\Sync\workspace\mlog\source> hexo s
INFO  Validating config
ERROR Plugin load failed: hexo-backlink
Error: ENOENT: no such file or directory, scandir 'D:\Sync\workspace\mlog\source\source\_posts'
    at _readAndFilterDirSync (D:\Sync\workspace\mlog\node_modules\hexo-fs\lib\fs.js:120:13)
    at _listDirSyncWalker (D:\Sync\workspace\mlog\node_modules\hexo-fs\lib\fs.js:173:22)
    at Object.listDirSync (D:\Sync\workspace\mlog\node_modules\hexo-fs\lib\fs.js:189:3)
    at D:\Sync\workspace\mlog\node_modules\hexo-backlink\index.js:7:4
    at D:\Sync\workspace\mlog\node_modules\hexo\lib\hexo\index.js:317:14
    at Promise._settlePromiseFromHandler (D:\Sync\workspace\mlog\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (D:\Sync\workspace\mlog\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromises (D:\Sync\workspace\mlog\node_modules\bluebird\js\release\promise.js:729:18)
    at _drainQueueStep (D:\Sync\workspace\mlog\node_modules\bluebird\js\release\async.js:93:12)
    at _drainQueue (D:\Sync\workspace\mlog\node_modules\bluebird\js\release\async.js:86:9)
    at Async._drainQueues (D:\Sync\workspace\mlog\node_modules\bluebird\js\release\async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\Sync\workspace\mlog\node_modules\bluebird\js\release\async.js:15:14)
    at processImmediate (internal/timers.js:461:21)

To fix it, change the way of construct base_dir in the plugin's code:

// index.js

// const base_dir = path.join(process.cwd(), "source", "_posts");
const base_dir = path.join(hexo.source_dir, "_posts");

suffix ".html"

the new link has suffix ".html", but I don't need it. How to remove the suffix ".html"?
image

About Image Display

image
I use _post dir like this structure, putting the images and markdown file in the same dir, so that i can use resources just by a file name. But in this way images couldnt work in my pages, what do I need to change
image
THANK YOU!

Test Issue

Test Issue integration with jira and gitkraken

Does not work in windows10.

When I run the install command npm install hexo-backlink
It return:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):  
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})  

+ [email protected]  

Will it support Windows platform in the futrue?

Post not found

_config.yml

# Writing
new_post_name: :title.md # works
# new_post_name: :year-:month-:day-:title.md # not work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.