Skip to content

Commit 1ecfb23

Browse files
committed
Initial comments plugin
0 parents  commit 1ecfb23

17 files changed

Lines changed: 2847 additions & 0 deletions

File tree

‎.github/workflows/build-plugin.yml‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build Comments Plugin
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['v*']
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Install Rust toolchain (wasm32-wasip1)
22+
uses: dtolnay/rust-toolchain@v1
23+
with:
24+
toolchain: stable
25+
targets: wasm32-wasip1
26+
27+
- name: Set up Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
32+
- name: Determine plugin metadata
33+
run: |
34+
set -eux
35+
PLUGIN_ID=$(jq -r '.id' plugin.json)
36+
PLUGIN_VERSION=$(jq -r '.version' plugin.json)
37+
echo "PLUGIN_ID=$PLUGIN_ID" >> "$GITHUB_ENV"
38+
echo "PLUGIN_VERSION=$PLUGIN_VERSION" >> "$GITHUB_ENV"
39+
echo "PLUGIN_ZIP=${PLUGIN_ID}-plugin.zip" >> "$GITHUB_ENV"
40+
41+
- name: Install frontend deps
42+
run: npm ci || npm i --no-audit --no-fund
43+
working-directory: frontend
44+
45+
- name: Build frontend bundle
46+
run: npm run build
47+
working-directory: frontend
48+
49+
- name: Build backend wasm
50+
run: cargo build --release --target wasm32-wasip1
51+
working-directory: backend
52+
53+
- name: Package plugin assets
54+
run: |
55+
set -eux
56+
DIST=dist
57+
rm -rf "$DIST"
58+
mkdir -p "$DIST/backend"
59+
WASM="backend/target/wasm32-wasip1/release/${PLUGIN_ID}_plugin_backend.wasm"
60+
cp "$WASM" "$DIST/backend/plugin.wasm"
61+
cp frontend/dist/index.mjs "$DIST/index.mjs"
62+
cp plugin.json "$DIST/plugin.json"
63+
(cd "$DIST" && zip -r "../${PLUGIN_ZIP}" .)
64+
65+
- name: Upload artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: ${{ env.PLUGIN_ID }}-plugin
69+
path: ${{ env.PLUGIN_ZIP }}
70+
71+
- name: Create release
72+
if: startsWith(github.ref, 'refs/tags/')
73+
id: create_release
74+
uses: actions/create-release@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
tag_name: ${{ github.ref_name }}
79+
release_name: ${{ github.ref_name }}
80+
draft: false
81+
prerelease: false
82+
83+
- name: Upload release asset
84+
if: startsWith(github.ref, 'refs/tags/')
85+
uses: actions/upload-release-asset@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
upload_url: ${{ steps.create_release.outputs.upload_url }}
90+
asset_path: ${{ env.PLUGIN_ZIP }}
91+
asset_name: ${{ env.PLUGIN_ZIP }}
92+
asset_content_type: application/zip

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target/
2+
node_modules/
3+
dist/

‎README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Comments Plugin
2+
3+
Comments adds editor-attached discussion threads to RefMD Markdown documents. It lets you anchor comments to the current cursor or selection without changing the document source.
4+
5+
## Features
6+
7+
- Create comment threads from the current cursor or selection
8+
- Store threads, replies, tags, and resolved state in plugin records
9+
- Show threads in the editor right pane
10+
- Highlight anchors and selected ranges through the host editor API
11+
- Search, filter by tag, and show or hide resolved threads
12+
13+
## Install in RefMD
14+
15+
1. Download the release archive from:
16+
`https://github.com/refmdio/comments-plugin/releases/download/<tag>/comments-plugin.zip`
17+
2. Inside RefMD, open **Plugins** -> **Install from URL** and paste the link.
18+
3. Open a Markdown document. The editor pane shows **Comments** for document discussion.

0 commit comments

Comments
 (0)