### Vim-like Keyboard Shortcut Setup Source: https://github.com/logseq/docs/blob/master/pages/Keyboard shortcuts.md A comprehensive example of a Vim-like keyboard shortcut configuration for various Logseq actions, including editor navigation and auto-completion. ```clojure :shortcuts {:editor/new-block "enter" :editor/new-line "shift+enter" ;; remap insert-link to something else to avoid conflicts :editor/insert-link "ctrl+shift+k" :editor/up ["ctrl+k" "up"] :editor/down ["ctrl+j" "down"] :editor/left ["ctrl+h" "left"] :editor/right ["ctrl+l" "right"] :editor/open-edit ["i" "enter"] :editor/backspace ["ctrl+d" "backspace"] :date-picker/complete ["enter"] :date-picker/prev-day ["ctrl+h" "left"] :date-picker/next-day ["ctrl+l" "right"] :date-picker/prev-week ["ctrl+k" "up"] :date-picker/next-week ["ctrl+j" "down"] :auto-complete/prev ["ctrl+k" "up"] :auto-complete/next ["ctrl+j" "down"] :auto-complete/complete ["ctrl+l" "enter"]} ``` -------------------------------- ### Serve Logseq Exported Files Locally (Python 3) Source: https://github.com/logseq/docs/blob/master/pages/Publishing (Desktop App Only).md Use this command to start a simple HTTP server for previewing your exported Logseq graph. Requires Python 3.x to be installed. ```bash cd export-folder python3 -m http.server ``` -------------------------------- ### Serve Logseq Exported Files Locally (Python 2) Source: https://github.com/logseq/docs/blob/master/pages/Publishing (Desktop App Only).md Use this command to start a simple HTTP server for previewing your exported Logseq graph. Requires Python 2.x to be installed. ```bash cd export-folder python -m SimpleHTTPServer ``` -------------------------------- ### Basic Query Example Source: https://github.com/logseq/docs/blob/master/pages/Query function.md This demonstrates how to build a simple query to retrieve items with a specific property. ```logseq {{query (property type book)}} ``` -------------------------------- ### Enable and Use Local HTTP Server Source: https://github.com/logseq/docs/blob/master/pages/Local Http server.md Instructions on how to enable the local HTTP server and examples of API calls. ```APIDOC ## Enable Local HTTP Server 1. Enable [[Developer mode]] in `Settings > Advanced > Developer mode`. 2. Enable HTTP APIs server in `Features > HTTP APIs server`. 3. Restart Logseq. 4. Add an authorization token in `Settings > Advanced > Developer mode`. 5. Start the HTTP server. ## API Documentation By default, API documentation is available at `http://127.0.0.1:12315/`. ## API Endpoints ### POST /api This endpoint allows you to interact with Logseq's functionalities via API calls. #### Description Send a POST request to the `/api` endpoint with a JSON body specifying the `method` to call and its `args`. #### Method POST #### Endpoint `http://127.0.0.1:12315/api` #### Request Body - **method** (string) - Required - The Logseq API method to call (e.g., `logseq.Editor.insertBlock`, `logseq.db.q`). Refer to [Logseq plugins API docs](https://plugins-doc.logseq.com/) for available methods. - **args** (array) - Required - An array of arguments to pass to the specified method. #### Request Example: Insert a new block ```curl curl -X POST http://127.0.0.1:12315/api \ -H "Authorization: Bearer {replace with your-token-value-here}" \ -H "Content-Type: application/json" \ -d '{"method": "logseq.Editor.insertBlock", "args": ["Test page", "This is a new block", {"isPageBlock": true}]}' ``` #### Response Example: Insert a new block (Success) ```json { "properties": {}, "unordered": true, "tags": [], "pathRefs": [], "uuid": "63b004bf-e5c3-4816-a722-8fdff330f666", "content": "This is a new block", "journal?": false, "macros": [], "page": 126, "format": "markdown", "refs": [] } ``` #### Request Example: Query TODOs ```curl curl -X POST http://127.0.0.1:12315/api \ -H "Authorization: Bearer {replace with your-token-value-here}" \ -H "Content-Type: application/json" \ -d '{"method": "logseq.db.q", "args": ["(task TODO)"]}' ``` #### Response Example: Query TODOs (Success) ```json [ { "parent": {"id": 4096}, "id": 4101, "pathRefs": [{"id": 4}, {"id": 487}, {"id": 665}], "uuid": "63afdd4f-a6eb-449c-9f47-85ef3fdf80e5", "content": "TODO Fill out feature's functionality #docs", "marker": "TODO", "page": {"name": "knowledge graph", "originalName": "Knowledge Graph", "id": 487}, "left": {"id": 4096}, "format": "markdown", "refs": [{"id": 4}, {"id": 665}] }, { "parent": {"id": 3876}, "id": 4530, "pathRefs": [{"id": 4}, {"id": 665}, {"id": 3876}], "uuid": "63afdd50-a458-42b1-87e5-fdc3a8391a02", "content": "TODO More specific name for this feature #docs", "marker": "TODO", "page": {"name": "search", "originalName": "Search", "id": 3876}, "left": {"id": 4520}, "format": "markdown", "refs": [{"id": 4}, {"id": 665}] }, { "parent": {"id": 331}, "id": 3793, "pathRefs": [{"id": 4}, {"id": 331}, {"id": 665}], "uuid": "63afdd4f-5b99-4143-80b7-c17f04d95d84", "content": "TODO Go through this miscellaneous list of pages to create or revamp #docs", "marker": "TODO", "page": {"name": "features", "originalName": "Features", "id": 331}, "left": {"id": 331}, "format": "markdown", "refs": [{"id": 4}, {"id": 665}] } ] ``` #### CORS Support Supports CORS for use from another web page or a browser extension. ``` -------------------------------- ### Example plugins.edn Configuration Source: https://github.com/logseq/docs/blob/master/pages/Changelog.md This snippet shows an example of the plugins.edn file format used for reproducible plugin configuration in Logseq. It lists various plugins with their versions, repositories, and effect/theme settings. ```clojure { :logseq-tags {:version "v0.1.2", :repo "gidongkwon/logseq-plugin-tags", :effect false, :theme false} :logseq-bionic-speedreader {:version "1.0.1", :repo "sawhney17/logseq-bionic-speedreader", :effect true, :theme false} :logseq-heatmap {:version "v2.4.2", :repo "pengx17/logseq-plugin-heatmap", :effect true, :theme false} :logseq-readwise-official-plugin {:version "v1.3.8", :repo "readwiseio/logseq-readwise-official-plugin", :effect true, :theme false} :logseq-my-highlights {:version "v1.16.7", :repo "theBenForce/logseq-plugin-my-highlights", :effect false, :theme false} :logseq-graph-analysis {:version "0.7.0", :repo "trashhalo/logseq-graph-analysis", :effect false, :theme false} :logseq-journals-calendar {:version "0.10.5", :repo "xyhp915/logseq-journals-calendar", :effect false, :theme false} } ``` ```clojure { :logseq-power-plugin {:version "v1.0.0", :repo "hkgnp/logseq-power-plugin", :effect true, :theme false} :logtools {:version "0.0.5", :repo "cannibalox/logtools", :effect false, :theme false} :logseq-swapblocks-plugin {:version "v1.3.0", :repo "hkgnp/logseq-swapblocks-plugin", :effect false, :theme false} :logseq-luma {:version "0.3.1", :repo "gavinmn/logseq-luma", :effect false, :theme true} :logseq-tablerender-plugin {:version "v1.9.0", :repo "hkgnp/logseq-tablerender-plugin", :effect false, :theme false} :logseq-heatmap {:version "v2.4.2", :repo "pengx17/logseq-plugin-heatmap", :effect true, :theme false} } ``` -------------------------------- ### Min Aggregate Function Example Source: https://github.com/logseq/docs/blob/master/pages/Query function.md An example of using the min aggregate function. ```logseq {{function (min :property)}} ``` -------------------------------- ### Logseq Example Data with Properties Source: https://github.com/logseq/docs/blob/master/pages/Properties.md Provides example data for Logseq pages, showcasing various properties like `updated-at`, `created-at`, `type`, `author`, `publication_date`, `price`, and `qty`. ```logseq [[How to take smart notes]] updated-at:: 1609337624066 created-at:: 1609233078964 type:: [[book]] author:: [[sönke ahrens]] publication_date:: [[february 21, 2017]] price:: 10 qty:: 1 ``` ```logseq [[How to solve it]] updated-at:: 1609337985298 created-at:: 1609233053383 type:: [[book]] author:: [[george polya]] price:: 20 qty:: 2 ``` -------------------------------- ### Logseq Simple Query Example Source: https://github.com/logseq/docs/blob/master/pages/changelog_06.md An example of a simple Logseq query to find all 'todo' items. This can be used in the 'Advanced Queries' feature. ```clojure {:title "All todos" :query (todo todo later done)} ``` -------------------------------- ### Example of Embedding a Page Source: https://github.com/logseq/docs/blob/master/pages/page_embed.md This is an example demonstrating how to embed a specific page named 'term/page' using the embed syntax. ```logseq {{{embed [[term/page]]}}} ``` -------------------------------- ### Sum Aggregate Function Example Source: https://github.com/logseq/docs/blob/master/pages/Query function.md An example of using the sum aggregate function. ```logseq {{function (sum :property)}} ``` -------------------------------- ### Count Aggregate Function Example Source: https://github.com/logseq/docs/blob/master/pages/Query function.md An example of using the count aggregate function. ```logseq {{function (count :property)}} ``` -------------------------------- ### Average Aggregate Function Example Source: https://github.com/logseq/docs/blob/master/pages/Query function.md An example of using the average aggregate function. ```logseq {{function (average :property)}} ``` -------------------------------- ### Max Aggregate Function Example Source: https://github.com/logseq/docs/blob/master/pages/Query function.md An example of using the max aggregate function. ```logseq {{function (max :property)}} ``` -------------------------------- ### Logseq Advanced Query Example Source: https://github.com/logseq/docs/blob/master/pages/changelog_06.md An example of an advanced Logseq query that includes 'doing' and 'now' states in addition to 'todo', 'later', and 'done'. ```clojure {:title "All todos" :query (and (todo todo later done doing now))} ``` -------------------------------- ### External PDF Link Example Source: https://github.com/logseq/docs/blob/master/pages/Changelog_07_09.md This example shows how to link to external PDFs using HTTP links within Logseq. This functionality was introduced as an enhancement in Beta 0.3.3. ```markdown  ``` -------------------------------- ### Add Custom Keyboard Shortcut Source: https://github.com/logseq/docs/blob/master/pages/Keyboard shortcuts.md Example of how to add a custom shortcut for toggling the theme in your `config.edn` file. ```clojure :shortcuts {:ui/toggle-theme "mod+c mod+t"} ``` -------------------------------- ### Page Query Example Source: https://github.com/logseq/docs/blob/master/pages/changelog_06.md Shows how to use the 'page' query to find pages with a specific alias. This is useful for referencing pages by their alternative names. ```clojure {{query (page "Page Alias")}} ``` -------------------------------- ### Logseq Query Example Source: https://github.com/logseq/docs/blob/master/pages/Changelog_2020.org Demonstrates how to use Logseq's simple query syntax to find tasks based on their status and tags. This feature was experimental at the time of release. ```logseq {{query (and (todo now later done) [[tag1]])}} ``` -------------------------------- ### Example of a block with a timestamp Source: https://github.com/logseq/docs/blob/master/pages/changelog_06.md An example of a block with a 'NOW' marker and an associated timestamp, likely used for tracking or scheduling within Logseq. ```logseq now:: 1613831559033 ``` -------------------------------- ### Footnote Example Source: https://github.com/logseq/docs/blob/master/pages/changelog_06.md Demonstrates how to use footnotes in Logseq. Supports simple and multi-paragraph footnotes with code. ```markdown Here's a simple footnote,[^1] and here's a longer one.[^bignote] [^1]: This is the first footnote. [^bignote]: Here's one with multiple paragraphs and code. ``` -------------------------------- ### Standard Markdown Syntax Examples Source: https://github.com/logseq/docs/blob/master/pages/Markdown.md Demonstrates basic Markdown formatting supported by Logseq, such as bold, italics, strikethrough, highlight, code, links, and images. ```markdown `**Bold**` ``` ```markdown `*Italics* ` ``` ```markdown `~~Strikethrough~~` ``` ```markdown `^^Highlight^^` ``` ```markdown [:div [:code "`Code`"] "-> " [:code "Code"]] ``` ```markdown `[label](https://example.com)` ``` ```markdown `` ``` -------------------------------- ### Extended Syntax: Properties Source: https://github.com/logseq/docs/blob/master/pages/Markdown.md Explains how to define properties for blocks, which are key-value pairs used for metadata. Includes examples for template-related properties. ```markdown property:: value ``` ```markdown template:: template-name ``` ```markdown template-including-parent:: false ``` -------------------------------- ### Create a Clojure Code Block Source: https://github.com/logseq/docs/blob/master/pages/Code block.md Example of a basic Clojure code block. Use this to display Clojure code snippets. ```clojure (println "WOOT!") ``` -------------------------------- ### Calc Mode Example Source: https://github.com/logseq/docs/blob/master/pages/changelog_06.md Demonstrates basic arithmetic operations and variable assignments within Logseq's calc mode. Use this for quick calculations directly within your notes. ```calc 1 + 1 a = 1 b = 2 a * b + a 1.0e3 + 2 ``` -------------------------------- ### Logseq Property Value Example Source: https://github.com/logseq/docs/blob/master/pages/Properties.md Demonstrates how property values can include links to pages, tags, and other text. Property values cannot contain newlines. ```logseq description:: [[Logseq]] is the fastest #triples #[[text editor]] ``` -------------------------------- ### Logseq Task Workflow Markers Source: https://github.com/logseq/docs/blob/master/pages/Tasks.md Examples of using Logseq's default and alternative task workflow markers. These can be typed directly or cycled using Ctrl/Cmd+enter. ```markdown LATER do grocery NOW play with Logseq DONE watch Doctor Who ``` ```markdown CANCELLED the boring thing ``` ```markdown IN-PROGRESS the fun thing ``` ```markdown WAIT the slow thing ``` -------------------------------- ### Logseq Deadline and Scheduled Dates Source: https://github.com/logseq/docs/blob/master/pages/Tasks.md Examples of setting deadlines and scheduled dates for tasks using Logseq commands. These commands allow for specific due dates and scheduling. ```markdown DEADLINE: <2021-05-29 Sat> ``` ```markdown SCHEDULED: <2021-05-31 Mon> ``` -------------------------------- ### Global and Local Config Merging Example Source: https://github.com/logseq/docs/blob/master/pages/Global config.edn.md Demonstrates how local configuration settings merge with global settings, specifically for map-based options like shortcuts. Local values override or add to global ones. ```clojure ;; global config {:shortcuts {:ui/toggle-theme "t z" :ui/toggle-brackets "t t"}} ;; local config {:shortcuts {:ui/toggle-brackets "t b"}} ;; resulting config {:shortcuts {:ui/toggle-theme "t z" :ui/toggle-brackets "t b"}} ``` -------------------------------- ### Logseq Plugin HTML Entry Point Source: https://github.com/logseq/docs/blob/master/pages/Plugins 01.md Sets up the basic HTML structure for a Logseq plugin, including the necessary script tag to load the Logseq JavaScript library. ```html