├── .gitignore
├── .vscode
└── settings.json
├── templates
├── annote.d.ts
└── markdown.ejs
├── package.json
├── LICENSE
├── .github
└── workflows
│ └── publish.yml
├── README.textile
├── pnpm-lock.yaml
├── logo
└── logo.svg
└── src
└── index.html
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.tabSize": 2
3 | }
4 |
--------------------------------------------------------------------------------
/templates/annote.d.ts:
--------------------------------------------------------------------------------
1 | interface Annote {
2 | id: number;
3 | color: string;
4 | style: number;
5 | tags: string[];
6 | note: string;
7 | type: string;
8 | html: string;
9 | text: string;
10 | annote: string;
11 | items: {
12 | str: string;
13 | root: string;
14 | }[];
15 | }
16 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "logseq-simpread",
3 | "version": "0.1.5",
4 | "description": "The official Logseq plugin of SimpRead.",
5 | "main": "src/index.html",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": ["logseq", "simpread", "logseq-plugin"],
10 | "author": "OverflowCat",
11 | "license": "MIT",
12 | "devDependencies": {
13 | "@logseq/libs": "^0.0.15"
14 | },
15 | "logseq": {
16 | "id": "logseq-simpread",
17 | "title": "SimpRead",
18 | "icon": "./logo/logo.svg",
19 | "description": "The official Logseq plugin of SimpRead."
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 OverflowCat
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/templates/markdown.ejs:
--------------------------------------------------------------------------------
1 | :PROPERTIES:
2 | :UID: {{timestamp}}
3 | :alias: {{title}}
4 | :source: {{url}}
5 | :snapshot: [{{idx}}](http://localhost:7026/reading/{{idx}}?embed=logseq)
6 | :tags: #SimpRead {{tags}}
7 | :index: {{idx}}
8 | :date: [[{{create|yyyy年mm月dd日}}]]
9 | :END:
10 |
11 | <%
12 | const colors = [ '#B4D9FB', '#ffeb3b', '#a2e9f2', '#a1e0ff', '#a8ea68', '#ffb7da' ];
13 | const my_annotations = unread.annotations.map((annote, i) => {
14 | const color = colors[annote.color];
15 | const uri = `http://localhost:7026/unread/${unread.idx}?embed=logseq#id=${i + 1}`;
16 | let res = `- ### [📌 #${i + 1}](${uri}) ${annote.tags}
17 | > [:p {:style {:background-color "${color}"}}
18 | "${annote.text}"]`;
19 | if (annote.note) res += "\n\n - " + annote.note;
20 | return res + '\n';
21 | }).join('\n');
22 | if (/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi.test(unread.title)) { %>
23 |
24 | <% if ( unread.refs ) { -%>
25 | - *外部引用* :: {{refs}}
26 | <% } -%>
27 | <% if (unread.desc) { -%>
28 | - ## ==摘要==
29 | - #+BEGIN_QUOTE
30 | <%- unread.desc %>
31 | #+END_QUOTE
32 | <% } -%>
33 |
34 | ## ==标注==
35 | <% if (unread.annotations.length > 0) { %>
36 | <%- my_annotations %>
37 | <% } %>
38 |
39 | <% } else { %>
40 |
41 | <% if ( unread.refs ) { -%>
42 | - *External references* :: {{refs}}
43 | <% } -%>
44 |
45 | <% if (unread.desc) { -%>
46 |
47 | ## ==Abstract==
48 | #+BEGIN_QUOTE
49 | <%- unread.desc %>
50 | #+END_QUOTE
51 | <% } -%>
52 |
53 | ## ==Annotations==
54 | <% if (unread.annotations.length > 0) { %>
55 | <%- my_annotations %>
56 | <% } -%>
57 | <% } %>
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: create-release
2 | on: [push]
3 | jobs:
4 | publish:
5 | runs-on: ubuntu-latest
6 | steps:
7 | - name: Install Pandoc
8 | run: |
9 | wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-linux-amd64.tar.gz
10 | tar -zxvf pandoc-2.18-linux-amd64.tar.gz -C ./
11 | mv pandoc-2.18/bin/pandoc ./pandoc
12 | - name: Clone repo
13 | run: "git clone https://github.com/OverflowCat/logseq-simpread.git"
14 | env:
15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 | - name: Convert README
17 | run: |
18 | cd logseq-simpread
19 | ../pandoc -i README.textile -o README.html
20 | mv README.html README.md
21 | - name: Bundle Logseq dependency
22 | run: |
23 | cd logseq-simpread
24 | echo "" >> lsplugin.user.min.js
27 | sed '8d' -i 'src/index.html'
28 | sed -e "7r lsplugin.user.min.js" -i 'src/index.html'
29 | - name: Create and upload archive
30 | run: |
31 | cd logseq-simpread
32 | version=$(jq -r '.version' package.json)
33 | echo "Now packaging version $version…"
34 | zip logseq-simpread-v${version}.zip src/* LICENSE README.md package.json logo/*.svg
35 | gh release create v${version} logseq-simpread-v${version}.zip package.json
36 | env:
37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 |
--------------------------------------------------------------------------------
/README.textile:
--------------------------------------------------------------------------------
1 |
2 | logseq-simpread
3 |
The official Logseq plugin of SimpRead.
4 |
5 |
6 | https://user-images.githubusercontent.com/20166026/179386714-38d2c5e0-690f-4df4-82b3-d16108350fc1.mp4
7 |
8 | h2. Usage
9 |
10 | 注意:本页面不包含使用教程,请前往简悦的 "这条 discussion":https://github.com/Kenshin/simpread/discussions/4220 查看。
11 |
12 | Currently the plugin contains only one function: triggering the reading list panel.
13 |
14 | To use this plugin, you need:
15 |
16 | * SimpRead, the browser extension installed
17 | * A premium account of SimpRead activated
18 | * Official *简悦 · 同步助手* installed, version >= 1.1.0
19 | * *Knowledge base* configured
20 | * *Automation* configured and enabled
21 | * *Markdown 模板辅助增强插件* installed and template configured
22 |
23 | The template used in the demo video is under @templates@.
24 |
25 | h2. Publishing
26 |
27 | h3. Packaging
28 |
29 | The code is written in a single vanilla HTML file. The only dependency is @lsplugin.user.min.js@. Just replace the one loaded from CDN with a local copy.
30 |
31 | h3. Logo
32 |
33 | Note that some objects are hidden. You can "mamage them with the Selection pane":https://support.microsoft.com/en-us/office/manage-objects-with-the-selection-pane-a6b2fd3e-d769-46c1-9b9c-b94e04a72550.
34 |
35 | To replicate @logo.svg@, please follow the instructions below:
36 |
37 | # Open the XML file with PowerPoint
38 | # Select all elements in the slide (Ctrl+A)
39 | # Group them (Ctrl+G)
40 | # Paste the combination in SVG format (Ctrl+Alt+V)
41 | # Right click, and save that SVG as a picture
42 |
43 | h2. Known issues
44 |
45 | h3. @top.document@
46 |
47 | @top.document@ may be removed by Logseq.
48 |
49 | h3. Color of the toolbar icon looks bad in some themes
50 |
51 | Currently the toolbar icon is in SVG format, which requires @.st1{stroke: #xxxxxx}@ to control its color. However, most buttons on the toolbar is in icon fonts, making unofficial themes like Bear use another approach to control icon colors.
52 |
53 | h3. Scroll bar
54 |
55 | The style of the scroll bar of the iframe does not match the official one's.
56 |
57 | h3. Hardcoded URL
58 |
59 | The port of simpread-sync is hardcoded to @7026@. A configuration UI will be added in the future.
60 |
61 | h2. Roadmap
62 |
63 | A new plugin API based highlights synchronization will be added in the future. Since Logseq plugins has no access to Node environment, it is impossible to implement the API in the same way as using Local REST API in Obsidian.
64 |
--------------------------------------------------------------------------------
/pnpm-lock.yaml:
--------------------------------------------------------------------------------
1 | lockfileVersion: 5.4
2 |
3 | specifiers:
4 | '@logseq/libs': ^0.0.14
5 |
6 | devDependencies:
7 | '@logseq/libs': 0.0.14
8 |
9 | packages:
10 |
11 | /@logseq/libs/0.0.14:
12 | resolution: {integrity: sha512-QcNeVxb4LIvV4Tid0ABZXV7fxYdZHynzLlukSk6Ydkuus+hBzLcjfK15nzybIRbiV7ANqSgTooDZkV/E4WP57Q==}
13 | dependencies:
14 | csstype: 3.1.0
15 | debug: 4.3.4
16 | dompurify: 2.3.8
17 | eventemitter3: 4.0.7
18 | fast-deep-equal: 3.1.3
19 | lodash-es: 4.17.21
20 | path: 0.12.7
21 | snake-case: 3.0.4
22 | transitivePeerDependencies:
23 | - supports-color
24 | dev: true
25 |
26 | /csstype/3.1.0:
27 | resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
28 | dev: true
29 |
30 | /debug/4.3.4:
31 | resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
32 | engines: {node: '>=6.0'}
33 | peerDependencies:
34 | supports-color: '*'
35 | peerDependenciesMeta:
36 | supports-color:
37 | optional: true
38 | dependencies:
39 | ms: 2.1.2
40 | dev: true
41 |
42 | /dompurify/2.3.8:
43 | resolution: {integrity: sha512-eVhaWoVibIzqdGYjwsBWodIQIaXFSB+cKDf4cfxLMsK0xiud6SE+/WCVx/Xw/UwQsa4cS3T2eITcdtmTg2UKcw==}
44 | dev: true
45 |
46 | /dot-case/3.0.4:
47 | resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==}
48 | dependencies:
49 | no-case: 3.0.4
50 | tslib: 2.4.1
51 | dev: true
52 |
53 | /eventemitter3/4.0.7:
54 | resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
55 | dev: true
56 |
57 | /fast-deep-equal/3.1.3:
58 | resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
59 | dev: true
60 |
61 | /inherits/2.0.3:
62 | resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==}
63 | dev: true
64 |
65 | /lodash-es/4.17.21:
66 | resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
67 | dev: true
68 |
69 | /lower-case/2.0.2:
70 | resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==}
71 | dependencies:
72 | tslib: 2.4.1
73 | dev: true
74 |
75 | /ms/2.1.2:
76 | resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
77 | dev: true
78 |
79 | /no-case/3.0.4:
80 | resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==}
81 | dependencies:
82 | lower-case: 2.0.2
83 | tslib: 2.4.1
84 | dev: true
85 |
86 | /path/0.12.7:
87 | resolution: {integrity: sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==}
88 | dependencies:
89 | process: 0.11.10
90 | util: 0.10.4
91 | dev: true
92 |
93 | /process/0.11.10:
94 | resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
95 | engines: {node: '>= 0.6.0'}
96 | dev: true
97 |
98 | /snake-case/3.0.4:
99 | resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==}
100 | dependencies:
101 | dot-case: 3.0.4
102 | tslib: 2.4.1
103 | dev: true
104 |
105 | /tslib/2.4.1:
106 | resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}
107 | dev: true
108 |
109 | /util/0.10.4:
110 | resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==}
111 | dependencies:
112 | inherits: 2.0.3
113 | dev: true
114 |
--------------------------------------------------------------------------------
/logo/logo.svg:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Simpread
8 |
9 |
10 |
11 |
12 |
206 |
207 |
208 |
--------------------------------------------------------------------------------