From 80808cc079805247ce49555b9c6dcbebcd79c09b Mon Sep 17 00:00:00 2001 From: perf3ct Date: Fri, 7 Apr 2023 11:29:07 -0700 Subject: [PATCH] Prettying up the README.md :) --- README.md | 122 +++++++++++++++++++++++++++--------------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index ab3d817..ef72352 100644 --- a/README.md +++ b/README.md @@ -14,42 +14,42 @@ Python client for ETAPI of Trilium Note. -* [trilium-py](#-trilium-py) -* [Table of Contents](#-table-of-contents) -* [Installation](#-installation) -* [(Basic) Usage](#-basic-usage) - * [Initialization](#-initialization) - * [Application Information](#-application-information) - * [Search note](#-search-note) - * [Create Note](#-create-note) - * [Create Image note](#️-create-image-note) - * [Get note](#-get-note) - * [Update note](#-update-note) - * [Delete note](#️-delete-note) - * [Day note](#-day-note) - * [Export note](#-export-note) -* [(Advanced Usage) TODO List](#advanced-usage--todo-list) - * [Add TODO item](#add-todo-item) - * [Check/Uncheck a TODO item](#checkuncheck-a-todo-item) - * [Update a TODO item](#update-a-todo-item) - * [Delete a TDOO item](#delete-a-tdoo-item) - * [Move yesterday's unfinished todo to today](#move-yesterdays-unfinished-todo-to-today) -* [(Advanced Usage) Upload Markdown files](#advanced-usage--upload-markdown-files) - * [Upload single Markdown file with images](#upload-single-markdown-file-with-images) - * [Bulk upload Markdown files in a folder!](#bulk-upload-markdown-files-in-a-folder) - * [Import from VNote](#import-from-vnote) - * [Import from Logseq](#import-from-logseq) - * [Import from Obsidian](#import-from-obsidian) - * [Import from Youdao Note/有道云笔记](#import-from-youdao-note有道云笔记) - * [Import from other markdown software](#import-from-other-markdown-software) -* [Develop](#️-develop) -* [Original OpenAPI Documentation](#-original-openapi-documentation) +- [🐍 trilium-py](#-trilium-py) +- [🦮 Table of Contents](#-table-of-contents) +- [🔧 Installation](#-installation) +- [📖 (Basic) Usage](#-basic-usage) + - [🚀 Initialization](#-initialization) + - [📊 Application Information](#-application-information) + - [🔍 Search note](#-search-note) + - [🏭 Create Note](#-create-note) + - [🖼️ Create Image note](#️-create-image-note) + - [👀 Get note](#-get-note) + - [🔄 Update note](#-update-note) + - [🗑️ Delete note](#️-delete-note) + - [📅 Day note](#-day-note) + - [📤 Export note](#-export-note) +- [(Advanced Usage) ✅ TODO List](#advanced-usage--todo-list) + - [Add TODO item](#add-todo-item) + - [Check/Uncheck a TODO item](#checkuncheck-a-todo-item) + - [Update a TODO item](#update-a-todo-item) + - [Delete a TDOO item](#delete-a-tdoo-item) + - [Move yesterday's unfinished todo to today](#move-yesterdays-unfinished-todo-to-today) +- [(Advanced Usage) 🚚 Upload Markdown files](#advanced-usage--upload-markdown-files) + - [Upload single Markdown file with images](#upload-single-markdown-file-with-images) + - [Bulk upload Markdown files in a folder](#bulk-upload-markdown-files-in-a-folder) + - [Import from VNote](#import-from-vnote) + - [Import from Logseq](#import-from-logseq) + - [Import from Obsidian](#import-from-obsidian) + - [Import from Youdao Note/有道云笔记](#import-from-youdao-note有道云笔记) + - [Import from other markdown software](#import-from-other-markdown-software) +- [🛠️ Develop](#️-develop) +- [🔗 Original OpenAPI Documentation](#-original-openapi-documentation) # 🔧 Installation -``` +```bash python3 -m pip install trilium-py --user ``` @@ -61,7 +61,7 @@ These are basic function that Trilium's ETAPI provides. Down below are some simp If you have a ETAPI token, change the `server_url` and `token` to yours. -``` +```python from trilium_py.client import ETAPI server_url = 'http://localhost:8080' @@ -72,7 +72,7 @@ ea = ETAPI(server_url, token) If you haven't created ETAPI token, you can create one with your password. Please note, you can only see this token once, please save it if you want to reuse the token. -``` +```python from trilium_py.client import ETAPI server_url = 'http://localhost:8080' @@ -88,7 +88,7 @@ After initialization, you can use Trilium ETAPI with python now. The following a To start with, you can get the application information like this. -``` +```python print(ea.app_info()) ``` @@ -98,7 +98,7 @@ It should give you the version of your server application and some extra informa Search note with keyword. -``` +```python res = ea.search_note( search="python", ) @@ -111,7 +111,7 @@ for x in res['results']: You can create a simple note like this. -``` +```python res = ea.create_note( parentNoteId="root", title="Simple note 1", @@ -123,7 +123,7 @@ res = ea.create_note( The `noteId` is not mandatory, if not provided, Trilium will generate a random one. You can retrieve it in the return. -``` +```python noteId = res['note']['noteId'] ``` @@ -132,7 +132,7 @@ noteId = res['note']['noteId'] Image note is a special kind of note. You can create an image note with minimal information like this. The `image_file` refers to the path of image. -``` +```python res = ea.create_image_note( parentNoteId="root", title="Image note 1", @@ -144,13 +144,13 @@ res = ea.create_image_note( To retrieve the note's content. -``` +```python ea.get_note_content("note1") ``` You can get a note metadata by its id. -``` +```python ea.get_note(note_id) ``` @@ -158,13 +158,13 @@ ea.get_note(note_id) Update note content -``` +```python ea.update_note_content("note1", "updated by python") ``` Modify note title -``` +```python ea.patch_note( noteId="note1", title="Python client moded", @@ -175,7 +175,7 @@ ea.patch_note( Simply delete a note by id. -``` +```python ea.delete_note("note1") ``` @@ -184,13 +184,13 @@ ea.delete_note("note1") You can get the content of a certain date with `get_day_note`. The date string should be in format of "%Y-%m-%d", e.g. " 2022-02-25". -``` +```python es.get_day_note("2022-02-25") ``` Then set/update a day note with `set_day_note`. The content should be a (html) string. -``` +```python self.set_day_note(date, new_content) ``` @@ -198,7 +198,7 @@ self.set_day_note(date, new_content) Export note comes in two formats `html` or `markdown`/`md`. -``` +```python res = ea.export_note( noteId='sK5fn4T6yZRI', format='md', @@ -214,7 +214,7 @@ With the power of Python, I have expanded the basic usage of ETAPI. You can do s You can use `add_todo` to add a TODO item, param is the TODO description -``` +```python ea.add_todo("买暖宝宝") ``` @@ -222,7 +222,7 @@ ea.add_todo("买暖宝宝") param is the index of the TODO item -``` +```python ea.todo_check(0) ea.todo_uncheck(1) ``` @@ -231,7 +231,7 @@ ea.todo_uncheck(1) Use `update_todo` to update a TODO item description at certain index. -``` +```python ea.update_todo(0, "去码头整点薯条") ``` @@ -239,7 +239,7 @@ ea.update_todo(0, "去码头整点薯条") Remove a TODO item by its index. -``` +```python ea.delete_todo(1) ``` @@ -248,7 +248,7 @@ ea.delete_todo(1) As the title suggests, you can move yesterday's unfinished things to today. Unfinished todos will be deleted from yesterday's note. -``` +```python ea.move_yesterday_unfinished_todo_to_today() ``` @@ -259,14 +259,14 @@ ea.move_yesterday_unfinished_todo_to_today() You can import Markdown file with images into Trilium now! Trilium-py will help you to upload the images and fix the links for you! -``` +```python res = ea.upload_md_file( parentNoteId="root", file="./md-demo/manjaro 修改caps lock.md", ) ``` -## Bulk upload Markdown files in a folder! +## Bulk upload Markdown files in a folder You can upload a folder with lots of Markdown files to Trilium and preserve the folder structure! @@ -274,7 +274,7 @@ You can upload a folder with lots of Markdown files to Trilium and preserve the Say, upload all the notes from [VNote](https://github.com/vnotex/vnote), simply do this: -``` +```python res = ea.upload_md_folder( parentNoteId="root", mdFolder="~/data/vnotebook/", @@ -284,7 +284,7 @@ res = ea.upload_md_folder( ### Import from Logseq -``` +```python res = ea.upload_md_folder( parentNoteId="root", mdFolder="/home/nate/data/logseq_data/", @@ -300,13 +300,13 @@ able to import the note into Trilium with trilium-py. Convert it first. -``` +```bash obsidian-export /path/to/your/vault /out ``` Then import just like a normal markdown, trilium-py will handle the images for you. -``` +```python res = ea.upload_md_folder( parentNoteId="root", mdFolder="E:/data/out", @@ -315,10 +315,10 @@ res = ea.upload_md_folder( ### Import from Youdao Note/有道云笔记 -Youdao does not provide an export feature anymore. Luckily, you can use https://github.com/DeppWang/youdaonote-pull to +Youdao does not provide an export feature anymore. Luckily, you can use to download your notes and convert them into markdown files. After that, trilium-py should be able to help you import them. -``` +```python res = ea.upload_md_folder( parentNoteId="root", mdFolder="/home/nate/gitRepo/youdaonote-pull/out/", @@ -329,7 +329,7 @@ res = ea.upload_md_folder( In general, markdown files have variety of standards. You can always try import them with -``` +```python res = ea.upload_md_folder( parentNoteId="root", mdFolder="/home/nate/data/your_markdown_files/", @@ -342,7 +342,7 @@ If there is any problem, please feel free to create an [issue](https://github.co Install with pip egg link to make package change without reinstall. -``` +```python python -m pip install --user -e . ```