Generate a shareable URL for a note using Base64 + zlib compression (Plannotator-compatible format).
From obsidian-vault-managernpx claudepluginhub ZorroCheng-MC/obsidian-vault-manager-plugin --plugin obsidian-vault-managerGenerate a shareable URL for a note using Base64 + zlib compression (Plannotator-compatible format).
Input: $ARGUMENTS (filename with or without .md extension)
Output: Shareable URL that can be opened by anyone
VAULT_PATH="/Users/zorro/Documents/Obsidian/Claudecode"
FILENAME="$ARGUMENTS"
# Add .md extension if missing
if [[ ! "$FILENAME" =~ \.md$ ]]; then
FILENAME="${FILENAME}.md"
fi
NOTE_PATH="$VAULT_PATH/$FILENAME"
Read the note content using the Read tool.
Use Python to compress and encode:
python3 << 'PYTHON_SCRIPT'
import sys
import json
import zlib
import base64
# Read content from stdin or file
content = """$NOTE_CONTENT"""
# Create Plannotator-compatible structure
data = {
"p": content, # Plan/content
"a": [] # Annotations (empty initially)
}
# Compress with zlib
json_str = json.dumps(data, ensure_ascii=False)
compressed = zlib.compress(json_str.encode('utf-8'))
# Base64 URL-safe encode
encoded = base64.urlsafe_b64encode(compressed).decode('utf-8')
# Generate URL
url = f"https://zorrocheng-mc.github.io/sharehub/share#{encoded}"
print(f"\nš¤ **Shareable URL:**\n")
print(f"```\n{url}\n```")
print(f"\nš URL copied to clipboard (if pbcopy available)")
# Try to copy to clipboard
import subprocess
try:
subprocess.run(['pbcopy'], input=url.encode(), check=True)
except:
pass
PYTHON_SCRIPT
Display:
https://zorrocheng-mc.github.io/sharehub/share#<compressed-base64>
The data structure matches Plannotator:
{
"p": "# Note content...",
"a": [["C", "section", "comment", "session-id", null]]
}
/share my-note.md
Output:
š¤ Shareable URL:
https://zorrocheng-mc.github.io/sharehub/share#eJxLTEoGAAJYAUI=
š URL copied to clipboard
/publish instead