Skip to content

feat: Live Preview embeds, PAT authentication, and MR status column - #35

Open
Ridermansb wants to merge 5 commits into
oliviergoulet5:mainfrom
Ridermansb:feat/personal-access-token-auth
Open

feat: Live Preview embeds, PAT authentication, and MR status column#35
Ridermansb wants to merge 5 commits into
oliviergoulet5:mainfrom
Ridermansb:feat/personal-access-token-auth

Conversation

@Ridermansb

@Ridermansb Ridermansb commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Enhances the Obsidian GitLab Embeds plugin with private instance auth, Live Preview embeds, and richer merge request cards that show merge state and CI pipeline status at a glance.

Previously, embeds only appeared in Reading view and MR cards showed basic metadata only. This branch makes embeds work while editing, supports authenticated access to private projects, and surfaces MR lifecycle + pipeline info on the card.


What's new

Live Preview embeds

  • GitLab issue and MR links now render as embed cards in Live Preview as well as Reading view
  • Source mode still shows the raw markdown link (unchanged)
  • Uses a CodeMirror 6 editor extension with WidgetType decorations, gated by editorLivePreviewField so embeds do not appear in source mode
  • Skips links inside code blocks and hides the widget while the link is selected (so you can still edit the URL)

Personal Access Token (PAT) authentication

  • Adds Personal access token auth alongside existing OAuth for private GitLab projects
  • Tokens are stored in Obsidian secret storage, not in plain settings
  • Per-instance auth: choose None, PAT, or OAuth (only one active method per instance)
  • Test connection button to verify credentials

Richer MR embed cards

MR cards now include a right-aligned status column:

Block Line 1 Line 2
Merge state Emoji + label (🟢 Open, 🔀 Merged, 🔒 Closed) Relevant date (opened / merged / closed)
Pipeline (when present) Emoji + status (✅ Passed, ❌ Failed, 🔄 Running, etc.) #pipeline-id · duration · finished date

Pipeline data comes from GitLab's head_pipeline field on the existing single MR API call — no extra request.

Developer experience

  • Refactored embed logic into shared modules used by both Reading view and Live Preview
  • Added npm run link:vault script for local vault symlink workflow
  • Updated README with Live Preview behavior and PAT setup instructions

Technical changes

New modules

  • src/gitlab-url.ts — URL parsing and project ID encoding
  • src/embed-service.ts — API fetch, caching, auth error handling
  • src/embed-renderer.ts — shared DOM rendering for issue/MR cards + status blocks
  • src/live-preview-extension.ts — CM6 ViewPlugin for Live Preview widgets
  • src/codemirror-shims.d.ts — TypeScript shims for Obsidian-bundled CodeMirror modules

Updated modules

  • src/main.ts — slimmed down; registers post processor + editor extension
  • src/api-client.ts — PAT support; maps head_pipeline on merge requests
  • src/settings.ts — per-instance auth UI (None / PAT / OAuth)
  • styles.css — card layout (gitlab-embed-body, gitlab-embed-aside) and status block styles

Architecture

Reading view → MarkdownPostProcessor → embed-service → embed-renderer Live Preview → CM6 ViewPlugin/widget → embed-service → embed-renderer

Both paths share the same fetch and render logic so issue/MR cards stay consistent.

Test plan

  • Paste a public GitLab issue URL → embed renders in Reading view and Live Preview
  • Paste a public GitLab MR URL → embed renders in both modes
  • Open MR with passing pipeline → right column shows merge state + ✅ Passed with pipeline meta
  • Open MR with failing pipeline → shows ❌ Failed
  • Open MR without CI → merge state shown; no pipeline block
  • Merged MR → shows 🔀 Merged with merged date
  • Open MR → shows 🟢 Open with created date
  • Configure self-hosted GitLab base URL for an unconfigured instance
  • Configure PAT for a private project → embed loads; 401/403 shows settings notice
  • Source mode → raw link only, no embed widget
  • Select a GitLab link in Live Preview → widget hides so URL is editable
  • Link inside a code block → not replaced with embed

Riderman de Sousa Barbosa and others added 4 commits June 15, 2026 20:15
OAuth tokens were never sent on API requests, so private issues could not
embed. Add per-instance personal access tokens (SecretStorage) with OAuth
as fallback, plus connection test and auth error notices.

Co-authored-by: Cursor <cursoragent@cursor.com>
Let users pick one auth method per instance (none, PAT, or OAuth) with
clearer settings UI. Fix API client reload on URL changes, implement
merge request embeds, and add link:vault for symlink-based dev setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extract shared embed logic and register a CodeMirror extension so pasted URLs render as cards while editing, with clearer feedback for unconfigured self-hosted instances.

Co-authored-by: Cursor <cursoragent@cursor.com>
Surface head_pipeline and MR state in a right-aligned status column so notes show CI and merge progress at a glance.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Ridermansb Ridermansb changed the title Add PAT auth for private GitLab embeds feat: Live Preview embeds, PAT authentication, and MR status column Jun 16, 2026
Fetch paginated MR discussions with a compact header UI, fix Live Preview so URLs inside fenced blocks are not treated as link embeds, and only show unconfigured-instance errors when the instance is actually missing from settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant