MyGit

pengx17/logseq-plugin-link-preview

Fork: 17 Star: 120 (更新于 2024-11-14 14:09:38)

license: MIT

Language: TypeScript .

Preview links in logseq

最后发布版本: v2.3.0 ( 2024-03-25 10:02:25)

GitHub网址

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.

最近版本更新:(数据更新于 2024-08-28 00:16:01)

2024-03-25 10:02:25 v2.3.0

2023-02-27 16:14:57 v2.2.10

2022-07-18 11:05:08 v2.2.9

2022-06-29 17:46:37 v2.2.8

2022-05-21 14:04:05 v2.2.7

2022-05-07 00:29:50 v2.2.6

2022-04-29 21:17:44 v2.2.5

2022-04-26 15:11:05 v2.2.4

2022-04-25 15:11:56 v2.2.3

2022-04-18 17:37:06 v2.2.2

主题(topics):

logseq, plugin

pengx17/logseq-plugin-link-preview同语言 TypeScript最近更新仓库

2024-11-22 01:36:46 twentyhq/twenty

2024-11-21 22:40:05 LLOneBot/LLOneBot

2024-11-21 20:34:48 CopilotKit/CopilotKit

2024-11-21 16:58:07 labring/FastGPT

2024-11-21 16:14:54 RSSNext/Follow

2024-11-21 16:12:23 x-extends/vxe-table