mirror of
https://github.com/h-sphere/sql-seal.git
synced 2026-07-22 10:10:28 +00:00
Merge pull request #73 from h-sphere/feat/better-links
feat: improved how the links are being parsed and presented.
This commit is contained in:
commit
69b18d87ad
5 changed files with 32 additions and 9 deletions
|
|
@ -1,3 +1,7 @@
|
|||
# 0.23.0 (2025-02-04)
|
||||
- Added support for wikilinks in the `a` function. You can now use markdown links in your queries.
|
||||
- Improved how links are being rendered. Now using native links with the preview on hover
|
||||
|
||||
# 0.22.3 (2025-02-04)
|
||||
- Ability to enable / disable query refreshing individually for each query (REFRESH / NO REFRESH statement)
|
||||
- (Advanced) Added ability to show SQL execution plan for the query
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "sqlseal",
|
||||
"name": "SQLSeal",
|
||||
"version": "0.22.3",
|
||||
"version": "0.23.0",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Use SQL in your notes to query your vault files and CSV content.",
|
||||
"author": "hypersphere",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sqlseal",
|
||||
"version": "0.22.3",
|
||||
"version": "0.23.0",
|
||||
"description": "A plugin for Obsidian that allows you to run SQL queries on your notes.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { App } from "obsidian"
|
||||
import { App, getLinkpath, parseLinktext } from "obsidian"
|
||||
import { CellParserRegistar } from "src/cellParser"
|
||||
|
||||
export const displayNotice = (el: HTMLElement, text: string) => {
|
||||
|
|
@ -13,6 +13,8 @@ export const displayError = (el: HTMLElement, text: string) => {
|
|||
|
||||
const isLinkLocal = (link: string) => !link?.trim().startsWith('http')
|
||||
|
||||
const isLinktext = (link: string) => link.startsWith('[[') && link.endsWith(']]')
|
||||
|
||||
|
||||
const renderCheckbox = (app: App) => ([value]: [string]) => {
|
||||
const el = createEl('input', {
|
||||
|
|
@ -30,16 +32,32 @@ const renderLink = (app: App) => ([name, href]: [string, string]) => {
|
|||
if (!href) {
|
||||
href = name
|
||||
}
|
||||
if (isLinkLocal(href)) {
|
||||
href = href.trim()
|
||||
let cls = ''
|
||||
if (isLinktext(href)) {
|
||||
const [path, linkName] = href.slice(2, -2).split('|')
|
||||
const link = app.metadataCache.getFirstLinkpathDest(path, '')
|
||||
|
||||
if (name.trim() === href) {
|
||||
name = linkName ?? path
|
||||
}
|
||||
|
||||
if (!link) {
|
||||
href = path
|
||||
} else {
|
||||
href = link.path
|
||||
}
|
||||
cls = 'internal-link'
|
||||
|
||||
} else if (isLinkLocal(href)) {
|
||||
let fileHref = href
|
||||
if (fileHref.endsWith('.md')) {
|
||||
fileHref = fileHref.slice(0, -3)
|
||||
}
|
||||
const vaultName = encodeURIComponent((app as any).appId);
|
||||
const encodedPath = encodeURIComponent(fileHref);
|
||||
href = `obsidian://open?vault=${vaultName}&file=${encodedPath}`;
|
||||
href = href
|
||||
cls = 'internal-link'
|
||||
}
|
||||
const el = createEl('a', { text: name, href: href })
|
||||
const el = createEl('a', { text: name, href, cls })
|
||||
return el
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,5 +39,6 @@
|
|||
"0.22.0": "0.15.0",
|
||||
"0.22.1": "0.15.0",
|
||||
"0.22.2": "0.15.0",
|
||||
"0.22.3": "0.15.0"
|
||||
"0.22.3": "0.15.0",
|
||||
"0.23.0": "0.15.0"
|
||||
}
|
||||
Loading…
Reference in a new issue