# dd-calendar **Repository Path**: cdon1006/dd-calendar ## Basic Information - **Project Name**: dd-calendar - **Description**: 一款obsidian calendar插件 - **Primary Language**: Unknown - **License**: 0BSD - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-29 - **Last Updated**: 2025-10-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DD Calendar - Obsidian 日历插件 这是一个为Obsidian (https://obsidian.md) 开发的日历插件,提供日期查看和管理功能。 - 与 Obsidian 插件系统深度集成 - 使用 TypeScript 开发,确保类型安全 - React 用于构建交互组件(如事件编辑模态框) - 样式: CSS + 可能使用 UI 框架(如Obsidian的默认样式) - 数据存储: Obsidian 本地存储 + Markdown 文件 ## 插件概述 DD Calendar插件提供了以下核心功能: - 在Obsidian界面左侧添加日历访问按钮 - 提供设置页面,允许用户自定义插件行为 - 支持命令面板操作 - 可扩展的日历视图系统(计划实现) - 支持与Obsidian笔记的日期关联(计划实现) ## 项目结构 项目使用TypeScript开发,利用类型检查和自动生成的文档提升代码质量。主要文件包括: ### 核心文件说明 #### main.ts 插件的主要入口文件,包含以下核心组件: - `MyPlugin`: 主插件类,负责生命周期管理和功能注册 - `SampleModal`: 示例模态窗口类,演示如何创建自定义弹窗 - `SampleSettingTab`: 设置选项卡类,提供插件配置界面 - `MyPluginSettings`: 设置接口定义 #### styles.css 插件的样式定义文件,包含以下样式组件: - 功能区图标样式 - 模态窗口样式 - 设置界面样式 - 响应式设计调整 #### manifest.json 插件元数据配置文件,包含: - `id`: 插件唯一标识符 - `name`: 插件名称显示在UI中 - `version`: 插件版本号,遵循语义化版本规范 - `minAppVersion`: 插件要求的最低Obsidian版本 - `description`: 插件功能描述 - `author`: 插件作者信息 - `isDesktopOnly`: 是否仅支持桌面版(false表示同时支持移动版) #### package.json 项目依赖和构建配置文件,包含: - 项目名称、版本和描述 - 构建脚本定义 - 开发依赖列表 - Node.js版本要求 ## 插件配置详解 ### manifest.json配置 ```json { "id": "sample-dd-calendar", // 插件唯一ID,一旦发布不应更改 "name": "DD Calendar", // 插件显示名称 "version": "1.0.0", // 插件版本号 "minAppVersion": "0.15.0", // 最低兼容Obsidian版本 "description": "A calendar plugin for Obsidian", // 插件描述 "author": "cdon", // 作者名称 "authorUrl": "https://obsidian.md", // 作者URL "fundingUrl": "https://obsidian.md/pricing", // 资助链接 "isDesktopOnly": false // 是否仅支持桌面版 } ``` ### package.json主要配置 ```json { "name": "obsidian-dd-calendar", // npm包名称 "version": "1.0.0", // 与manifest.json保持一致的版本号 "description": "This is a calendar plugin for Obsidian", "main": "main.js", // 构建输出的主文件 "scripts": { "dev": "node esbuild.config.mjs", // 开发模式构建脚本 "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", // 生产构建脚本 "version": "node version-bump.mjs && git add manifest.json versions.json" // 版本更新脚本 }, // 开发依赖列表 "devDependencies": { "@types/node": "^16.11.6", "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "builtin-modules": "3.3.0", "esbuild": "0.17.3", "obsidian": "latest", "tslib": "2.4.0", "typescript": "4.7.4" } } ## First time developing plugins? Quick starting guide for new plugin devs: - Check if [someone already developed a plugin for what you want](https://obsidian.md/plugins)! There might be an existing plugin similar enough that you can partner up with. - Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it). - Clone your repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder. - Install NodeJS, then run `npm i` in the command line under your repo folder. - Run `npm run dev` to compile your plugin from `main.ts` to `main.js`. - Make changes to `main.ts` (or create new `.ts` files). Those changes should be automatically compiled into `main.js`. - Reload Obsidian to load the new version of your plugin. - Enable plugin in settings window. - For updates to the Obsidian API run `npm update` in the command line under your repo folder. ## Releasing new releases - Update your `manifest.json` with your new version number, such as `1.0.1`, and the minimum Obsidian version required for your latest release. - Update your `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of your plugin that's compatible. - Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix `v`. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases - Upload the files `manifest.json`, `main.js`, `styles.css` as binary attachments. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release. - Publish the release. > You can simplify the version bump process by running `npm version patch`, `npm version minor` or `npm version major` after updating `minAppVersion` manually in `manifest.json`. > The command will bump version in `manifest.json` and `package.json`, and add the entry for the new version to `versions.json` ## Adding your plugin to the community plugin list - Check the [plugin guidelines](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines). - Publish an initial version. - Make sure you have a `README.md` file in the root of your repo. - Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin. ## How to use - Clone this repo. - Make sure your NodeJS is at least v16 (`node --version`). - `npm i` or `yarn` to install dependencies. - `npm run dev` to start compilation in watch mode. ## Manually installing the plugin - Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`. ## Improve code quality with eslint (optional) - [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code. - To use eslint with this project, make sure to install eslint from terminal: - `npm install -g eslint` - To use eslint to analyze this project use this command: - `eslint main.ts` - eslint will then create a report with suggestions for code improvement by file and line number. - If your source code is in a folder, such as `src`, you can use eslint with this command to analyze all files in that folder: - `eslint ./src/` ## Funding URL You can include funding URLs where people who use your plugin can financially support it. The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file: ```json { "fundingUrl": "https://buymeacoffee.com" } ``` If you have multiple URLs, you can also do: ```json { "fundingUrl": { "Buy Me a Coffee": "https://buymeacoffee.com", "GitHub Sponsor": "https://github.com/sponsors", "Patreon": "https://www.patreon.com/" } } ``` ## API Documentation See https://github.com/obsidianmd/obsidian-api