Skip to content

Commit 916568c

Browse files
committed
works
0 parents  commit 916568c

18 files changed

+2068
-0
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_style = tab
9+
indent_size = 4
10+
tab_width = 4

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
3+
main.js

.eslintrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"env": { "node": true },
5+
"plugins": [
6+
"@typescript-eslint"
7+
],
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/eslint-recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:prettier/recommended"
13+
],
14+
"parserOptions": {
15+
"sourceType": "module"
16+
},
17+
"rules": {
18+
"no-unused-vars": "off",
19+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
20+
"@typescript-eslint/ban-ts-comment": "off",
21+
"no-prototype-builtins": "off",
22+
"@typescript-eslint/no-empty-function": "off"
23+
}
24+
}

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release Obsidian plugin
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Use Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: "18.x"
19+
20+
- name: Build plugin
21+
run: |
22+
npm install
23+
npm run build
24+
25+
- name: Create release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
tag="${GITHUB_REF#refs/tags/}"
30+
31+
gh release create "$tag" \
32+
--title="$tag" \
33+
main.js manifest.json styles.css

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# vscode
2+
.vscode
3+
4+
# Intellij
5+
*.iml
6+
.idea
7+
8+
# npm
9+
node_modules
10+
11+
# Don't include the compiled main.js file in the repo.
12+
# They should be uploaded to GitHub releases instead.
13+
main.js
14+
15+
# Exclude sourcemaps
16+
*.map
17+
18+
# obsidian
19+
data.json
20+
21+
# Exclude macOS Finder (System Explorer) View States
22+
.DS_Store

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tag-version-prefix=""

.prettierrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
printWidth: 120,
3+
tabWidth: 4,
4+
useTabs: false,
5+
semi: true,
6+
singleQuote: true,
7+
trailingComma: 'all',
8+
bracketSpacing: true,
9+
bracketSameLine: false,
10+
arrowParens: 'avoid',
11+
};

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Kodai Kabasawa
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Click Hint Plugin for Obsidian
2+
3+
A plugin for [Obsidian](https://obsidian.md) that enhances navigation by providing keyboard-driven hints for clickable elements.
4+
5+
![Screencast from 2024-11-03 00-50-53](https://github.com/user-attachments/assets/231e9ea3-8133-4e1d-b14b-1d4ce2020d3f)
6+
7+
Inspired by:
8+
- easymotion/vim-easymotion: Vim motions on speed! https://github.com/easymotion/vim-easymotion
9+
- philc/vimium: The hacker's browser. https://github.com/philc/vimium
10+
- mrjackphil/obsidian-jump-to-link: Quick jump between links using hotkeys https://github.com/mrjackphil/obsidian-jump-to-link
11+
12+
## Features
13+
14+
- Quick keyboard navigation to any clickable element (links, buttons, etc.)
15+
- Customizable hint characters
16+
- Configurable hint appearance (background and foreground colors)
17+
- Support for both internal and external links
18+
- Visual feedback for partial matches
19+
- Efficient hint generation algorithm
20+
21+
## How to Use
22+
23+
1. Install the plugin from Obsidian's Community Plugins
24+
2. Enable the plugin in Obsidian settings
25+
3. Use the command "Show click hints" to activate hint mode
26+
4. Type the characters shown in the hints to navigate to your desired element
27+
28+
## Configuration
29+
30+
You can customize the following settings:
31+
32+
- **Hint Characters**: Define which characters to use for hints (default: a-z)
33+
- **Background Color**: Set the background color of hint markers
34+
- **Foreground Color**: Set the text color for matched characters in hints
35+
36+
## Installation
37+
38+
### From Obsidian
39+
40+
1. Open Settings in Obsidian
41+
2. Navigate to Community Plugins and disable Safe Mode
42+
3. Click Browse and search for "Click Hint"
43+
4. Install the plugin and enable it
44+
45+
### Manual Installation
46+
47+
1. Download the latest release from the releases page
48+
2. Extract the files to your `.obsidian/plugins/link-hint/` folder
49+
3. Reload Obsidian
50+
4. Enable the plugin in Community Plugins settings
51+

esbuild.config.mjs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import esbuild from 'esbuild';
2+
import process from 'process';
3+
import builtins from 'builtin-modules';
4+
5+
const banner = `/*
6+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
7+
if you want to view the source, please visit the github repository of this plugin
8+
*/
9+
`;
10+
11+
const prod = process.argv[2] === 'production';
12+
13+
const context = await esbuild.context({
14+
banner: {
15+
js: banner,
16+
},
17+
entryPoints: ['main.ts'],
18+
bundle: true,
19+
external: [
20+
'obsidian',
21+
'electron',
22+
'@codemirror/autocomplete',
23+
'@codemirror/collab',
24+
'@codemirror/commands',
25+
'@codemirror/language',
26+
'@codemirror/lint',
27+
'@codemirror/search',
28+
'@codemirror/state',
29+
'@codemirror/view',
30+
'@lezer/common',
31+
'@lezer/highlight',
32+
'@lezer/lr',
33+
...builtins,
34+
],
35+
format: 'cjs',
36+
target: 'es2018',
37+
logLevel: 'info',
38+
sourcemap: prod ? false : 'inline',
39+
treeShaking: true,
40+
outfile: 'main.js',
41+
minify: prod,
42+
});
43+
44+
if (prod) {
45+
await context.rebuild();
46+
process.exit(0);
47+
} else {
48+
await context.watch();
49+
}

0 commit comments

Comments
 (0)