Obsidian:Templater 模板
This commit is contained in:
parent
a1106b8047
commit
f8c966dc3e
48
src/js/hitokoto.js
Normal file
48
src/js/hitokoto.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
const https = require('https');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一言
|
||||||
|
* @param {Object} options - 请求的参数
|
||||||
|
* @returns {Promise<string>} 返回一言的句子
|
||||||
|
*/
|
||||||
|
async function getHitokoto(options = {}) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const {
|
||||||
|
c, // 句子类型
|
||||||
|
encode = 'json', // 默认使用json格式
|
||||||
|
charset, // 字符集
|
||||||
|
callback, // 调用的异步函数
|
||||||
|
select, // 选择器
|
||||||
|
min_length, // 返回句子的最小长度
|
||||||
|
max_length // 返回句子的最大长度
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
let url = 'https://v1.hitokoto.cn?';
|
||||||
|
|
||||||
|
if (c) url += `&c=${c}`;
|
||||||
|
if (encode) url += `&encode=${encode}`;
|
||||||
|
if (charset) url += `&charset=${charset}`;
|
||||||
|
if (callback) url += `&callback=${callback}`;
|
||||||
|
if (select) url += `&select=${select}`;
|
||||||
|
if (min_length) url += `&min_length=${min_length}`;
|
||||||
|
if (max_length) url += `&max_length=${max_length}`;
|
||||||
|
|
||||||
|
https.get(url, (resp) => {
|
||||||
|
let data = '';
|
||||||
|
|
||||||
|
resp.on('data', (chunk) => {
|
||||||
|
data += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
resp.on('end', () => {
|
||||||
|
const result = JSON.parse(data);
|
||||||
|
resolve(result.hitokoto);
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on("error", (err) => {
|
||||||
|
reject("Error: " + err.message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = getHitokoto;
|
37
src/js/jinrishici.js
Normal file
37
src/js/jinrishici.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
const https = require('https');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取今日诗词并格式化输出
|
||||||
|
* @returns {Promise<string>} 返回格式化后的诗词
|
||||||
|
*/
|
||||||
|
async function getTodayPoetry() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const url = 'https://v2.jinrishici.com/one.json';
|
||||||
|
|
||||||
|
https.get(url, (resp) => {
|
||||||
|
let data = '';
|
||||||
|
|
||||||
|
resp.on('data', (chunk) => {
|
||||||
|
data += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
resp.on('end', () => {
|
||||||
|
const result = JSON.parse(data);
|
||||||
|
if (result.status === "success") {
|
||||||
|
const poetryContent = result.data.content;
|
||||||
|
const author = result.data.origin.author;
|
||||||
|
const dynasty = result.data.origin.dynasty;
|
||||||
|
const formattedPoetry = `${poetryContent}——${author}(${dynasty})`;
|
||||||
|
resolve(formattedPoetry);
|
||||||
|
} else {
|
||||||
|
reject("Failed to fetch poetry");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on("error", (err) => {
|
||||||
|
reject("Error: " + err.message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = getTodayPoetry;
|
36
src/js/wttr_weather.js
Normal file
36
src/js/wttr_weather.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
const https = require('https');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定城市的天气信息
|
||||||
|
* @param {string} city - 城市名
|
||||||
|
* @param {string} params - wttr.in的查询参数
|
||||||
|
* @returns {Promise<string>} 天气信息
|
||||||
|
*/
|
||||||
|
function getWeather(city = 'Shanghai', params = 'format=3') {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
reject(new Error('Request timed out'));
|
||||||
|
}, 5000); // 设置5秒的请求超时
|
||||||
|
|
||||||
|
https.get(`https://wttr.in/${encodeURIComponent(city)}?${params}`, (resp) => {
|
||||||
|
let data = '';
|
||||||
|
|
||||||
|
// A chunk of data has been received.
|
||||||
|
resp.on('data', (chunk) => {
|
||||||
|
data += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
// The whole response has been received. Print out the result.
|
||||||
|
resp.on('end', () => {
|
||||||
|
clearTimeout(timeout); // 清除超时
|
||||||
|
resolve(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on("error", (err) => {
|
||||||
|
clearTimeout(timeout); // 清除超时
|
||||||
|
reject("Error: " + err.message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = getWeather;
|
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
authors:
|
|
||||||
- slorber
|
|
||||||
- yangshun
|
|
||||||
- name: Joel Marcey
|
|
||||||
title: Docusaurus 1 合作创造者
|
|
||||||
url: https://github.com/JoelMarcey
|
|
||||||
image_url: https://github.com/JoelMarcey.png
|
|
||||||
email: jimarcey@gmail.com
|
|
||||||
title: string | 博文的标题
|
|
||||||
date: string | 博文的创建时间
|
|
||||||
tags:
|
|
||||||
- 标签
|
|
||||||
draft: boolean | 一个布尔值,表明博文处于未完成状态。 博文草稿只会在开发模式下显示。
|
|
||||||
hide_table_of_contents: boolean | 是否隐藏右侧的文档目录。
|
|
||||||
toc_min_heading_level: number | 目录中显示的最小标题层级。 必须介于 2 到 6 之间,并且小于等于最大值。
|
|
||||||
toc_max_heading_level: number | 目录中显示的最大标题层级。 必须介于 2 和 6。
|
|
||||||
keywords:
|
|
||||||
- 用于搜索引擎优化的文档关键词元标签。
|
|
||||||
description: string | 文档的描述信息
|
|
||||||
image: string | 显示文档链接时所用的缩略图或封面。
|
|
||||||
slug: string | 自定义文档的 URL
|
|
||||||
---
|
|
||||||
|
|
||||||
一篇博客 - 完全模板
|
|
@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
id: string | 文档的唯一 ID
|
|
||||||
title: string | 文档文本标题
|
|
||||||
pagination_label: string | 这篇文档在上一篇/下一篇按钮中显示的文本
|
|
||||||
sidebar_label:string | 这篇文档在侧边栏中显示的文本
|
|
||||||
sidebar_position: number | 使用 `autogenerated` 自动生成侧边栏项目时,控制文档在侧边栏中出现的位置顺序。
|
|
||||||
sidebar_class_name: string | 在使用自动生成侧边栏时,给相应的侧边栏标签一个特殊类名。
|
|
||||||
hide_title: boolean | 是否隐藏文档顶部显示的标题。 此选项只会隐藏前言中定义的标题,对于 Markdown 文档顶部的标题没有任何影响。
|
|
||||||
hide_table_of_contents: boolean | 是否隐藏右侧的文档目录。
|
|
||||||
toc_min_heading_level: number | 目录中显示的最小标题层级。 必须介于 2 到 6 之间,并且小于等于最大值。
|
|
||||||
toc_max_heading_level: number | 目录中显示的最大标题层级。 必须介于 2 和 6。
|
|
||||||
pagination_next: string | null | 「下篇文档」按钮链接到的文档 ID。 `null` 会禁用本页的「下篇文档」按钮。
|
|
||||||
pagination_prev: string | null | 「上篇文档」按钮链接到的文档 ID。 `null` 会禁用本页的「上篇文档」按钮。
|
|
||||||
parse_number_prefixes: boolean | 是否禁用本文档的数字前缀解析。 另见[使用数字前缀]
|
|
||||||
custom_edit_url: string | 编辑此文档时要跳转到的 URL。
|
|
||||||
keywords:
|
|
||||||
- 用于搜索引擎优化的文档关键词元标签。
|
|
||||||
description: string | 文档的描述信息
|
|
||||||
image: string | 显示文档链接时所用的缩略图或封面。
|
|
||||||
slug: string | 自定义文档的 URL
|
|
||||||
tags:
|
|
||||||
- 文档标签
|
|
||||||
draft: boolean | 表明文档处于未完成状态
|
|
||||||
date: 1/1/2000
|
|
||||||
author: 自定义作者名
|
|
||||||
---
|
|
||||||
|
|
||||||
一篇文档 - 完全模板
|
|
@ -4,42 +4,55 @@
|
|||||||
|
|
||||||
| Date | Weather | Moon |
|
| Date | Weather | Moon |
|
||||||
| -------------- | ------------ | ---- |
|
| -------------- | ------------ | ---- |
|
||||||
| <% tp.date.now("ddd HH:mm") %> | <% tp.web.daily_weather("郑州","zh") %> | <% tp.web.daily_weather("郑州","zh","?format=%m") %> |
|
| <% tp.date.now("ddd HH:mm") %> | <% tp.user.wttr_weather("郑州", "m&format=%l+%t+%c&lang=zh") %> | <% tp.user.wttr_weather("郑州", "format=%m&lang=zh") %> |
|
||||||
|
|
||||||
## 😊 Emotions
|
## 😊 Emotions
|
||||||
|
|
||||||
- [ ] 😊 Happy
|
| Emotion | Reason or Trigger |
|
||||||
- [ ] 😢 Sad
|
|------------------|-------------------------------|
|
||||||
- [ ] 😡 Angry
|
| 😊 Happy | |
|
||||||
- [ ] 😔 Disappointed
|
| 😢 Sad | |
|
||||||
- [ ] 😂 Laughing
|
| 😡 Angry | |
|
||||||
- [ ] 😭 Crying
|
| 😔 Disappointed | |
|
||||||
- [ ] 😱 Scared
|
| 😂 Laughing | |
|
||||||
|
| 😭 Crying | |
|
||||||
|
| 😱 Scared | |
|
||||||
|
|
||||||
## 🍎 Health
|
## 🍎 Health
|
||||||
|
|
||||||
| Type | Content | Days/Count |
|
| Type | Days/Count | Description |
|
||||||
| ------------ | ------- | ---------- |
|
| ----------------- | ---------- | ----------------------- |
|
||||||
| Diet records | | |
|
| Diet records | | |
|
||||||
| Exercise log | | |
|
| Exercise log | | |
|
||||||
| Sleep log | | |
|
| Sleep log | | |
|
||||||
|
| Hydration | | |
|
||||||
|
| Mental Relaxation | | |
|
||||||
|
|
||||||
## 🚀 Process
|
## ✅ What Went Well
|
||||||
|
|
||||||
- [项目名称/任务名称]:进行中/已完成,进度 [进度百分比]。
|
| Task/Activity | Progress | Priority |
|
||||||
|
| ------------------- | ------------- | -------- |
|
||||||
|
| [项目名称/任务名称] | 进行中/已完成 | ⭐⭐⭐ |
|
||||||
|
|
||||||
## 🚧 Problem
|
## ❌ What Didn't Go Well
|
||||||
|
|
||||||
- [问题名称]:[问题描述],解决方案:[解决方案]。
|
| Challenge/Issue | Description | Possible Solution | Impact Level |
|
||||||
|
| ----------------- | ------------ | ----------------- | --------------- |
|
||||||
|
| [问题名称] | [问题描述] | [潜在解决方案] | ⭐⭐⭐ |
|
||||||
|
|
||||||
## 📝 Note
|
## ⏭️ Next Steps
|
||||||
|
|
||||||
## 📊 ThisWeek
|
| Task/Activity | Planned Status | Time Allocation |
|
||||||
|
| ------------------- | -------------- | --------------- |
|
||||||
|
| [项目名称/任务名称] | 进行中/已完成 | |
|
||||||
|
|
||||||
| Score | Evaluation |
|
## 📝 Notes
|
||||||
| ----- | ---------- |
|
|
||||||
| | |
|
|
||||||
|
|
||||||
## 🎯 NextWeek
|
本周学习点或收获
|
||||||
|
|
||||||
|
## 📊 ThisWeek's Overview
|
||||||
|
|
||||||
|
| Score (1-10) | Self Evaluation | Feedback from Others |
|
||||||
|
| ------------ | --------------- | -------------------- |
|
||||||
|
| | | |
|
||||||
|
|
||||||
- [项目名称/任务名称]:进行中/已完成,进度 [进度百分比]。
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
| Date | Weather | Moon |
|
| Date | Weather | Moon |
|
||||||
| -------------- | ------------ | ---- |
|
| -------------- | ------------ | ---- |
|
||||||
| <% tp.date.now("ddd HH:mm") %> | <% tp.user.getWeather() %> | <% tp.user.getMoon() %> |
|
| <% tp.date.now("ddd HH:mm") %> | <% tp.user.wttr_weather("郑州", "m&format=%l+%t+%c&lang=zh") %> | <% tp.user.wttr_weather("郑州", "format=%m&lang=zh") %> |
|
||||||
|
|
||||||
## 🌟 Overview
|
## 🌟 Overview
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
| Date | Weather | Moon |
|
| Date | Weather | Moon |
|
||||||
| -------------- | ------------ | ---- |
|
| -------------- | ------------ | ---- |
|
||||||
| <% tp.date.now("ddd HH:mm") %> | <% tp.web.daily_weather("郑州","zh") %> | <% tp.web.daily_weather("郑州","zh","?format=%m") %> |
|
| <% tp.date.now("ddd HH:mm") %> | <% tp.user.wttr_weather("郑州", "m&format=%l+%t+%c&lang=zh") %> | <% tp.user.wttr_weather("郑州", "format=%m&lang=zh") %> |
|
||||||
|
|
||||||
## 📖 Daily
|
## 📖 Daily
|
||||||
|
|
||||||
<% tp.web.daily_poetry() %>
|
<% tp.user.jinrishici() %>
|
||||||
|
|
||||||
## 😊 Emotions
|
## 😊 Emotions
|
||||||
|
|
||||||
@ -26,13 +26,15 @@
|
|||||||
- [ ] 🥕 Healthy eating
|
- [ ] 🥕 Healthy eating
|
||||||
- [ ] ☕️ Drink more hot water
|
- [ ] ☕️ Drink more hot water
|
||||||
- [ ] 💪 Keep exercising
|
- [ ] 💪 Keep exercising
|
||||||
|
- [ ] 🧘♂️ Meditation
|
||||||
|
|
||||||
## 📋 To-do List
|
## 📋 To-do List
|
||||||
|
|
||||||
- [ ] 📰 Read news
|
- [ ] 📰 Read news
|
||||||
- [ ] 🖋️ Calligraphy practice
|
|
||||||
- [ ] 📖 Read a book today
|
- [ ] 📖 Read a book today
|
||||||
- [ ] 📝 Make a plan for today
|
- [ ] 📝 Make a plan for today
|
||||||
- [ ] 📌 Share something today
|
- [ ] 🖋️ Calligraphy practice
|
||||||
|
- [ ] 🎯 deliberate practice
|
||||||
|
|
||||||
|
|
||||||
## 📝 Notes
|
## 📝 Notes
|
||||||
|
Loading…
Reference in New Issue
Block a user