• Stars
    star
    113
  • Rank 310,115 (Top 7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Preview links in logseq

Logseq Plugin Link Preview

A simple plugin to show basic link information (based on OpenGraph Protocol) for external links in Logseq.

By default when it is enabled, when you hovering any external link in Logseq, it will show the link preview. Also this plugin will register a Convert to Link Card command for you to convert the link to a link card.

Features

  • Show link preview when hovering any external link in Logseq
  • Convert the link to a link card when you use the Convert to Link Card command
  • Cache the results locally
  • Light & dark theme

Demo

How does this plugin work?

There are two modes of this plugin:

  • Hovering mode
  • Macro mode

The two modes are working very differently, but they codes are mostly shared.

Hovering Mode

It will register mouseenter and mouseleave events on all external links in the main document of Logseq. Note, in this step this plugin uses a unsafe top context of the main document, which might not work in the future.

In the listener, the plugin will extract the href attribute of the link and send a request to an API server to get the link information (the OpenGraph metadata).

Once the api returns with the link metadata (e.g., title, description, image), the plugin will

  • render them in the plugin iframe
  • resize the iframe and move its position to the hovering link

Macro Mode

Typically, user will use slash command to create a custom renderer Marco :linkpreview with the URL as the argument

{{renderer :linkpreview,https://google.com}}

When it is rendered, the logseq.App.onMacroRendererSlotted hook will fetch the link information from the API server and render it with ReactDomServer.renderToString method into the slot. The plugin will register the styles into the global context.

More Repositories

1

logseq-dev-theme

</> Logseq dev theme
CSS
375
star
2

logseq-publish

Archived. Please check https://github.com/logseq/publish-spa instead
JavaScript
353
star
3

logseq-plugin-tabs

A Logseq plugin which lets you open pages in tabs like working in the browser
TypeScript
299
star
4

logseq-plugin-bullet-threading

Add bullet threading to your active blocks in Logseq.
TypeScript
149
star
5

logseq-plugin-heatmap

Activity heatmap for logseq
TypeScript
145
star
6

logseq-plugin-todo-master

A simple plugin to render a progress bar to gather the overall progress of the TODO markers based on the rendering position.
TypeScript
110
star
7

logseq-plugin-template-react

Logseq plugin boilerplate for React. Powered by Vite ✨
TypeScript
107
star
8

logseq-laurel-theme

CSS
53
star
9

logseq-plugin-random-tools

TypeScript
24
star
10

pengx17.github.io

我的博客
CSS
21
star
11

knowledge-garden

JavaScript
19
star
12

logseq-plugin-js-playground

TypeScript
16
star
13

logseq-plugin-template-svelte

svelte template for logseq plugins
JavaScript
15
star
14

yjs-textarea-demo

A nearly full featured YJS demo on textarea
TypeScript
10
star
15

vite-plugin-logseq

Vite plugin for developing Logseq Plugins
TypeScript
9
star
16

next-blog-neo

TypeScript
6
star
17

github-board

TypeScript
5
star
18

logseq-query-playground-ui

Clojure
4
star
19

facedetect

A library wrapper for OpenCV. detect faces in (including YUV) images and output a bitmap for the found area.
C++
4
star
20

nextjs-blog

My personal blog
TypeScript
3
star
21

octobase-node

Rust
2
star
22

logseq-query-playfround

Svelte
2
star
23

logseq-plugin-template-vue

logseq, vue, vite
TypeScript
2
star
24

adventofcode2022

Clojure
1
star
25

yjs-playground

Created with StackBlitz ⚡️
TypeScript
1
star
26

idle-game

just for fun
TypeScript
1
star
27

firebase-login

TypeScript
1
star
28

knotes

TypeScript
1
star
29

slides

JavaScript
1
star
30

nc_polymer

Slack like chatroom, built with Polymer
HTML
1
star
31

test-publish-github

1
star
32

next-blog-affine

TypeScript
1
star
33

pengx17

1
star
34

electron-multi-tabs-demo

TypeScript
1
star