Obsidian Smart Connections 项目教程

随笔1天前发布 風舆
4 0 0

Obsidian Smart Connections 项目教程

obsidian-smart-connectionsChat with your notes in Obsidian! Plus, see what's most relevant in real-time! Interact and stay organized. Powered by OpenAI ChatGPT, GPT-4 & Embeddings.项目地址:https://gitcode.com/gh_mirrors/ob/obsidian-smart-connections

1. 项目的目录结构及介绍

Obsidian Smart Connections 项目的目录结构如下:


obsidian-smart-connections/
├── .github/
│   └── workflows/
│       └── main.yml
├── assets/
│   └── icon.png
├── src/
│   ├── main.ts
│   ├── styles.css
│   └── view.ts
├── .gitignore
├── .obsidian.json
├── LICENSE
├── README.md
├── package.json
└── tsconfig.json

目录结构介绍

.github/workflows/: 包含 GitHub Actions 的工作流配置文件。assets/: 存放项目的静态资源,如图标等。src/: 项目的源代码目录,包含主要的 TypeScript 文件和样式文件。.gitignore: 指定 Git 忽略的文件和目录。.obsidian.json: Obsidian 插件的配置文件。LICENSE: 项目的开源许可证。README.md: 项目的说明文档。package.json: 项目的依赖和脚本配置文件。tsconfig.json: TypeScript 的编译配置文件。

2. 项目的启动文件介绍

项目的启动文件位于 src/main.ts。该文件是插件的入口点,负责初始化插件并注册必要的 Obsidian 事件。


import { Plugin } from 'obsidian';
import { SmartConnectionsView, VIEW_TYPE_SMART_CONNECTIONS } from './view';
 
export default class SmartConnectionsPlugin extends Plugin {
    async onload() {
        this.registerView(VIEW_TYPE_SMART_CONNECTIONS, (leaf) => new SmartConnectionsView(leaf));
    }
}

启动文件介绍

src/main.ts: 插件的主入口文件,继承自 Plugin 类,并在 onload 方法中注册视图。

3. 项目的配置文件介绍

项目的配置文件主要包括 package.json.obsidian.json

package.json

package.json 文件定义了项目的依赖、脚本和其他元数据。


{
  "name": "obsidian-smart-connections",
  "version": "1.0.0",
  "description": "A smart connections plugin for Obsidian",
  "main": "main.js",
  "scripts": {
    "dev": "rollup --config rollup.config.js -w",
    "build": "rollup --config rollup.config.js"
  },
  "keywords": [],
  "author": "Brian Petro",
  "license": "MIT",
  "devDependencies": {
    "obsidian": "^0.12.0",
    "rollup": "^2.38.0"
  }
}

.obsidian.json

.obsidian.json 文件是 Obsidian 插件的配置文件,通常包含插件的设置和选项。


{
  "enabled": true,
  "apiKey": "your-api-key"
}

配置文件介绍

package.json: 定义了项目的名称、版本、描述、主入口文件、脚本、关键词、作者、许可证和开发依赖。.obsidian.json: 包含插件的启用状态和 API 密钥等配置选项。

以上是 Obsidian Smart Connections 项目的详细教程,涵盖了项目的目录结构、启动文件和配置文件的介绍。

obsidian-smart-connectionsChat with your notes in Obsidian! Plus, see what's most relevant in real-time! Interact and stay organized. Powered by OpenAI ChatGPT, GPT-4 & Embeddings.项目地址:https://gitcode.com/gh_mirrors/ob/obsidian-smart-connections

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...