diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 26e7748..a891b7d 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -19,6 +19,7 @@ export default defineConfig({ { text: 'Quick Start', link: '/quick-start' }, { text: 'Using properties', link: '/using-properties' }, { text: 'Query Vault Content', link: '/query-vault-content' }, + { text: 'Links and Images', link: '/links-and-images' }, { text: 'Troubleshooting', link: '/troubleshooting' }, { text: 'Future Plans', link: '/future-plans' }, ] diff --git a/docs/links-and-images-advanced.png b/docs/links-and-images-advanced.png new file mode 100644 index 0000000..7f7f3e8 Binary files /dev/null and b/docs/links-and-images-advanced.png differ diff --git a/docs/links-and-images.md b/docs/links-and-images.md new file mode 100644 index 0000000..ab1ab99 --- /dev/null +++ b/docs/links-and-images.md @@ -0,0 +1,46 @@ +# Links and Images +Introduced in version 0.8. Make sure you are using up to date version. + +SQLSeal allows for rendering links and images. For now the images needs to be external ones (no support for stored images for now but should be added in the future releases). + +## Links +To display a link, wrap use the `a` SQL function, for example: +```sql +SELECT a(path) FROM files LIMIT 10 +``` +![Example of links](./links.png) + +You can use second parameter to provide name for the link: + +```sql +SELECT a(path, name) from files LIMIT 10 +``` + + +This API works for both filesystem and CSV files. + +## Images +You can embed images within your results. You need to wrap your resulting column with `img` function. + +```sql +SELECT name, img(coverImg) FROM files +``` + +## Advanced Examples +The example below uses [Goodreads-books](https://www.kaggle.com/datasets/jealousleopard/goodreadsbooks) Kaggle dataset in CSV loaded in obsidian to display books with links to Open Library and showing the covers from Open Library Cover API. It uses Obsidian property to filter the author name. + + +```sql +TABLE books = file(books.csv) + +SELECT +a('https://openlibrary.org/isbn/' || isbn13, title) as title, +authors, +isbn13, +img('https://covers.openlibrary.org/b/isbn/' || isbn13 || '-L.jpg') as cover +from books +WHERE authors LIKE concat('%', @author, '%') +LIMIT 10 +``` + +![Advanced links and images](links-and-images-advanced.png) \ No newline at end of file diff --git a/docs/links.png b/docs/links.png new file mode 100644 index 0000000..be75e2e Binary files /dev/null and b/docs/links.png differ