-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2eb802f
Showing
37 changed files
with
20,545 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
# export to obsidian plugin directory directly? | ||
OUT_DIR="./dist" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/dist | ||
/node_modules | ||
/lua/main.lua | ||
/.env.local | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 YISH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Obsidian Enhancing Export Plugin | ||
|
||
English | [中文](./README_zh-CN.md) | ||
|
||
This is an enhancing export plugin base on `Pandoc` for Obsidian ([https://obsidian.md/](https://obsidian.md/)). It's allow you to export to formats like `Markdown`、`Markdown (Hugo)`、`Html`、`docx`、`Latex` etc. | ||
|
||
Where `Markdown`、`Markdown (Hugo)`、`Html` will export and its media resource together. | ||
|
||
**Note:** `Markdown`、`Markdown (Hugo)`、`Html` are tested in Mac OS、Window、Linux as I used it for myself, others are not tested well. | ||
|
||
## Screen shot | ||
|
||
- Export view,click on `Export to ......` on file menu. | ||
![](screenshot/exportview_en-US.png) | ||
- Setting view | ||
![](screenshot/settingview_en-US.png) | ||
|
||
## Installation | ||
|
||
1. First install `pandoc` , and then add `pandoc` path to environment variable `PATH` or set absolute path of `pandoc` in the plugin setting view. | ||
|
||
See more details in [https://pandoc.org/installing.html](https://pandoc.org/installing.html)。 | ||
|
||
2. Search `obsidian-enhancing-export` in the community plugin of obsidian, and install it. | ||
|
||
## Custom export commands | ||
|
||
You can custom your export command by yourself, click `add` in the plugin setting view and then choose template `custom` to add new custom configuration. | ||
|
||
## Variables | ||
|
||
You can use `${variables}` in custom export command, their values are: | ||
|
||
| Key | Value | | ||
| ------------------------ | ------------------------------------------------------------ | | ||
| `${outputPath}` | Output file path after export. For example, if your export to location `/User/aaa/Documents/test.pdf`, then `${outputDir}` will be replace that path. | | ||
| `${outputDir}` | Output directory of saved exported file,It will be `/User/aaa/Documents` in above case. | | ||
| `${outputFileName}` | File name (without extension) of the saved exported file. It will be `test` in above case. | | ||
| `${outputFileFullName}` | File name (with extension) of the saved exported file. It will be `test.pdf` in above case. | | ||
| `${currentPath}` | Path of currently edited file. For example, if your are editing `/User/aaa/Documents/readme.md`, the the value will be `/User/aaa/Documents/readme.md`. | | ||
| `${currentDir}` | Current directory of currently edited file, It will be`/User/aaa/Documents` in above case. | | ||
| `${currentFileName}` | Filename without extension of currently edited file, It will be `readme` in above case. | | ||
| `${currentFileFullName}` | Filename with extension of currently edited file. It will be `readme.md` in above case. | | ||
|
||
## Finally | ||
|
||
- Welcome to provide more command templates. | ||
- Feel free to file an issue for any questions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Obsidian Enhancing Export Plugin | ||
|
||
[English](./README.md) | 中文 | ||
|
||
这是一个基于 Pandoc 的 Obsidian 加强版导出插件。提供了基本的导出格式:Markdown 、Markdown(Hugo [https://gohugo.io/](https://gohugo.io/))、Html、docx、Latex等。 | ||
其中 Markdown 、Markdown(Hugo)、Html 会把媒体资源一并导出。 | ||
|
||
**注意:**目前自用的就是 Markdown 、Markdown(Hugo)、Html,在 Mac OS、Windows、Linux 可正常使用,其他未经严格测试。 | ||
|
||
## 界面截图 | ||
- 导出界面,在文件菜单上点击 `导出为......` | ||
![](screenshot/exportview_zh-CN.png) | ||
- 设置界面 | ||
![](screenshot/settingview_zh-CN.png) | ||
|
||
## 安装 | ||
1. 需要先安装 `pandoc`,最好配置到 PATH 环境变量,或者设置界面指定路径。 | ||
参考地址:[https://pandoc.org/installing.html](https://pandoc.org/installing.html) | ||
2. 在 Obsidian 插件市场,搜索 `obsidian-enhancing-export` 进行安装。 | ||
|
||
## 自定义命令 | ||
|
||
本插件是支持自定义导出命令的,在设置界面,点击添加按钮,选择 `Custom` 作为模板,即可新增一个自定义导出的配置了。 | ||
|
||
### 变量 | ||
你可以使用 `${variable}` 在自定义导出的命令中。它们的值是: | ||
|
||
| 变量名 | 值 | | ||
| -- | -- | | ||
| `${outputPath}` |导出路径,例如,你的导出位置是:`/User/aaa/Documents/test.pdf` ,则 `${outputDir}` 会替换为那个路径。| | ||
| `${outputDir}` | 导出目录,按上面的例子,它会被替换为 `/User/aaa/Documents`。 | | ||
| `${outputFileName}` | 没有扩展名的文件名,按上面的例子,它会被替换为 `test`。 | | ||
| `${outputFileFullName}` | 文件的全名,按上面的例子,它会被替换为 `test.pdf`。 | | ||
| `${currentPath}` | 当前文件路径,例如当前的文件位置是 `/User/aaa/Documents/readme.md`,那么它会被替换为这个文件的位置。 | | ||
| `${currentDir}` | 当前文件所在目录,按上面的例子,值为 `/User/aaa/Documents`。 | | ||
| `${currentFileName}` | 当前文件不带扩展名的名字,值是 `readme` | | ||
| `${currentFileFullName}` | 当前文件全名,值是 `readme.md`。 | | ||
|
||
## 最后 | ||
|
||
- 欢迎提供更多命令模板。 | ||
- 有问题可以提交 Issue 给我。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import esbuild from 'esbuild'; | ||
import process from 'process'; | ||
import builtins from 'builtin-modules'; | ||
import { copy } from 'esbuild-plugin-copy'; | ||
import { config } from 'dotenv'; | ||
|
||
config({ path: '.env.local' }); | ||
config({ path: '.env' }); | ||
|
||
const { OUT_DIR } = process.env; | ||
|
||
|
||
|
||
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'); | ||
|
||
esbuild.build({ | ||
banner: { | ||
js: banner, | ||
}, | ||
entryPoints: [ | ||
'./src/main.ts', | ||
'./styles.css' | ||
], | ||
entryNames: '[name]', | ||
outbase: 'src', | ||
bundle: true, | ||
external: [ | ||
'obsidian', | ||
'electron', | ||
'@codemirror/autocomplete', | ||
'@codemirror/closebrackets', | ||
'@codemirror/collab', | ||
'@codemirror/commands', | ||
'@codemirror/comment', | ||
'@codemirror/fold', | ||
'@codemirror/gutter', | ||
'@codemirror/highlight', | ||
'@codemirror/history', | ||
'@codemirror/language', | ||
'@codemirror/lint', | ||
'@codemirror/matchbrackets', | ||
'@codemirror/panel', | ||
'@codemirror/rangeset', | ||
'@codemirror/rectangular-selection', | ||
'@codemirror/search', | ||
'@codemirror/state', | ||
'@codemirror/stream-parser', | ||
'@codemirror/text', | ||
'@codemirror/tooltip', | ||
'@codemirror/view', | ||
...builtins], | ||
loader: { '.json': 'file' }, | ||
format: 'cjs', | ||
watch: !prod, | ||
target: 'es2021', | ||
logLevel: 'info', | ||
sourcemap: prod ? false : 'inline', | ||
// sourcemap: 'both', | ||
// sourceRoot: './src', | ||
minify: prod, | ||
treeShaking: true, | ||
plugins: [ | ||
copy({ | ||
assets: [ | ||
{ | ||
from: ['./manifest.json'], | ||
to: './', | ||
},{ | ||
from: ['./lua/utf8_filenames.lua', './lua/polyfill.lua','./lua/url.lua', './lua/markdown.lua', './lua/markdown+hugo.lua'], | ||
to: ['./lua/.'], | ||
} | ||
] | ||
}) | ||
], | ||
outdir: OUT_DIR ?? 'dist', | ||
}).catch(() => process.exit(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package.path=package.path..";" ..debug.getinfo(1).source:match("(.*[/\\])"):sub(2) .. "?.lua" | ||
|
||
Mode='hugo' | ||
|
||
require('markdown') |
Oops, something went wrong.