Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kmbravo committed Oct 3, 2024
0 parents commit 99582e0
Show file tree
Hide file tree
Showing 16 changed files with 2,875 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
tab_width = 4
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/

main.js
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# vscode
.vscode

# Intellij
*.iml
.idea

# npm
node_modules

# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js

# Exclude sourcemaps
*.map

# obsidian
data.json

# Exclude macOS Finder (System Explorer) View States
.DS_Store
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tag-version-prefix=""
37 changes: 37 additions & 0 deletions README-ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# WikiLink 到 Markdown 转换器

[English](README.md)

## 中文

### 简介
WikiLink 到 Markdown 转换器是一个 Obsidian 插件,允许用户将笔记中的 WikiLinks 转换为标准 Markdown 链接。该插件旨在通过将 Obsidian 特定的链接格式转换为通用的 Markdown 语法,来提高笔记的兼容性和可移植性。

### 功能
- 将 WikiLinks 转换为 Markdown 链接
- 支持内部和外部链接
- 处理图片链接
- 提供用户友好的界面,包括确认对话框
- 支持多种语言(目前支持英语和中文)

### 支持的链接转换
1. 内部链接: `[[页面名称]]``[页面名称](页面名称.md)`
2. 带别名的内部链接: `[[页面名称|别名]]``[别名](页面名称.md)`
3. 外部链接: `[[https://example.com]]``[https://example.com](https://example.com)`
4. 带别名的外部链接: `[[https://example.com|示例]]``[示例](https://example.com)`
5. 图片链接: `![[图片.jpg]]``![](图片.jpg)`
6. 带替代文本的图片链接: `![[图片.jpg|替代文本]]``![替代文本](图片.jpg)`

### 使用方法
1. 在您的 Obsidian 库中安装插件。
2. 打开您想要转换的笔记。
3. 点击左侧边栏中的丝带图标(链接符号)。
4. 在弹出的对话框中确认转换。
5. 检查更改并确认应用。

### 设置
您可以在设置选项卡中更改插件的语言:
1. 转到设置 → 社区插件
2. 在列表中找到 "WikiLink 到 Markdown 转换器"
3. 点击齿轮图标打开插件设置
4. 从下拉菜单中选择您喜欢的语言
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# WikiLink to Markdown Converter

[中文](README-ZH.md)


### Introduction
The WikiLink to Markdown Converter is an Obsidian plugin that allows users to convert WikiLinks to standard Markdown links within their notes. This plugin aims to improve compatibility and portability of notes by transforming Obsidian-specific link formats into universally recognized Markdown syntax.

### Features
- Converts WikiLinks to Markdown links
- Supports both internal and external links
- Handles image links
- Provides a user-friendly interface with confirmation dialogs
- Supports multiple languages (currently English and Chinese)

### Supported Link Conversions
1. Internal links: `[[Page Name]]``[Page Name](Page%20Name.md)`
2. Internal links with aliases: `[[Page Name|Alias]]``[Alias](Page%20Name.md)`
3. External links: `[[https://example.com]]``[https://example.com](https://example.com)`
4. External links with aliases: `[[https://example.com|Example]]``[Example](https://example.com)`
5. Image links: `![[image.jpg]]``![image](image.jpg)`
6. Image links with alt text: `![[image.jpg|Alt Text]]``![Alt Text](image.jpg)`

### Usage
1. Install the plugin in your Obsidian vault.
2. Open the note you want to convert.
3. Click the ribbon icon (link symbol) in the left sidebar.
4. Confirm the conversion in the popup dialog.
5. Review the changes and confirm to apply them.

### Settings
You can change the plugin's language in the settings tab:
1. Go to Settings → Community Plugins
2. Find "WikiLink to Markdown Converter" in the list
3. Click on the gear icon to open the plugin settings
4. Choose your preferred language from the dropdown menu
49 changes: 49 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";

const banner =
`/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;

const prod = (process.argv[2] === "production");

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
minify: prod,
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
Loading

0 comments on commit 99582e0

Please sign in to comment.