Skip to content

Latest commit

 

History

History
57 lines (47 loc) · 3.6 KB

File metadata and controls

57 lines (47 loc) · 3.6 KB

Implemented Features

Molecule Grid View

  • Custom Bases view type (molecules) rendering molecular structures as SVG cards via RDKit.js
  • Configurable molecule and label properties via view options
  • Adjustable card width and height sliders
  • Click-to-open note navigation
  • Hover preview on cards
  • SVG render cache keyed by molecule string and current settings
  • Lazy viewport-based rendering via IntersectionObserver — only calls RDKit for molecules visible (or near-visible) on screen; configurable via lazyRender setting (default on), falls back to chunked eager rendering when off
  • Chunked async rendering (batches of 20 per frame) to avoid blocking the UI with 100+ molecules (used when lazy render is off)
  • CSS containment on cards for reduced layout cost
  • Event delegation for click and hover handlers
  • Text search — debounced (configurable delay, default 300ms) case-insensitive filter across all frontmatter properties and file names
  • SMARTS substructure search — toggle to SMARTS mode to filter molecules by substructure pattern; matching molecules are highlighted with atom/bond coloring via get_svg_with_highlights; supports first match (default) or all matches (smartsMatchAll setting)
  • Search bar with separate Text and SMARTS mode buttons and result counter ("N of M")

SDF Import

  • Command to import SDF files via browser file picker
  • Parses SDF into one note per molecule with YAML frontmatter
  • Extracts MOL blocks and > <NAME> property headers
  • Converts MOL blocks to SMILES via RDKit
  • Generates a .base file scoped to the import folder

CSV Import

  • Command to import CSV files via browser file picker
  • Creates one note per row with YAML frontmatter; notes are named row_1, row_2, etc.
  • All CSV columns added as frontmatter properties (keys sanitized to lowercase with non-alphanumeric characters replaced by _)
  • Generates a .base file scoped to the import folder
  • Handles quoted fields and escaped double quotes per RFC 4180
  • No RDKit dependency — SMILES are taken directly from the CSV
  • Select the molecule property in the view options after import

Rendering Settings

  • Remove hydrogens (removeHs, default off) — strips hydrogen atoms before rendering
  • Use original coordinates (useCoords, default on) — uses input coordinates as-is; when off, regenerates clean 2D layouts
  • Store MOL block (storeMolblock, default on) — includes full MOL block in frontmatter during SDF import
  • Highlight all SMARTS matches (smartsMatchAll, default off) — highlights all substructure matches instead of just the first
  • Search delay (searchDelay, default 300ms) — configurable debounce delay for search input
  • Bond line width (bondLineWidth, default 1.0) — configurable thickness of bonds in molecule depictions
  • Transparent background (transparentBg, default off) — removes white background from molecule SVGs; works better with dark themes
  • Comic mode (comicMode, default off) — hand-drawn style molecule rendering via RDKit's MolDrawOptions

RDKit Integration

  • Singleton lazy loader for RDKit WASM
  • Automatically downloads RDKit_minimal.js and .wasm from unpkg CDN on first use (version-pinned to match dependency)
  • Caches downloaded files in the plugin directory — subsequent loads are instant with no network required
  • Uses Obsidian's requestUrl API for downloads (handles CORS in Electron)
  • Shows a Notice during initial download (~7MB WASM file)
  • Injects JS as blob URL script, initializes with WASM binary
  • Deduplicates concurrent init calls
  • Proper WASM memory management (mol.delete() after each render)