🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

markdown-link-card

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-link-card

Vue 3 Notion-style link preview cards for markdown and standalone use, with CSS variable theming and streaming skeletons

latest
Source
npmnpm
Version
0.1.1-beta.3
Version published
Maintainers
1
Created
Source

English | 简体中文

Vue 3 link preview cards for Markdown (custom tags and link-card fenced blocks), with streaming skeletons and CSS variable theming.

Install

npm install markdown-link-card
PackageNotes
vue ^3.5Required peer
markstream-vue ^1.0Install when rendering inside Markdown
stream-markdownInstall when using the markstream code-highlight stack

Global setup

Register the plugin and import styles in your app entry:

import { createApp } from 'vue'
import { createMarkdownLinkCardPlugin } from 'markdown-link-card'
import 'markdown-link-card/setup.css'
import App from './App.vue'

createApp(App).use(createMarkdownLinkCardPlugin()).mount('#app')
Style entryDescription
markdown-link-card/setup.cssTheme variables + component styles (recommended)
markdown-link-card/theme.cssCSS variables only
markdown-link-card/style.cssComponent styles only

Plugin options

OptionDefaultDescription
scopeIdmarkdown-link-cardCustom renderer scope id
registerMarkdownRendertrueAlso register the MarkdownRender component globally
createApp(App).use(
  createMarkdownLinkCardPlugin({ scopeId: 'my-app', registerMarkdownRender: false }),
)

Use in Markdown

<script setup lang="ts">
import MarkdownRender from 'markstream-vue'
import { useLinkCardMarkdown } from 'markdown-link-card'

const linkCard = useLinkCardMarkdown()

const content = `
<link-card
  url="https://vuejs.org/"
  title="Vue.js"
  description="The Progressive JavaScript Framework"
/>
`
</script>

<template>
  <MarkdownRender
    v-bind="linkCard"
    :content="content"
  />
</template>

useLinkCardMarkdown() returns customId and customHtmlTags for spreading onto MarkdownRender. Outside <script setup>, use getLinkCardMarkdownProps().

Standalone LinkCard

Render a card without Markdown:

<script setup lang="ts">
import { LinkCard } from 'markdown-link-card'
import 'markdown-link-card/style.css'

const card = {
  url: 'https://example.com',
  title: 'Example',
  description: 'Site description',
  image: 'https://example.com/og.png',
}
</script>

<template>
  <LinkCard :card="card" />
</template>
PropTypeDescription
cardLinkCardDataurl, title; optional description, image
loadingbooleanShow loading skeleton
unstyledbooleanLayout only, no default theme colors

Markdown syntax

HTML tag

<link-card
  url="https://example.com"
  title="Title"
  description="Description"
  image="https://example.com/cover.png"
/>

Fenced block (JSON)

```link-card
{
  "url": "https://example.com",
  "title": "Title",
  "description": "Description"
}
```

Streaming content

When Markdown is appended incrementally, wrap incomplete <link-card> tags:

<script setup lang="ts">
import MarkdownRender from 'markstream-vue'
import { computed, ref } from 'vue'
import {
  markdownWithLinkCardTagPlaceholder,
  useLinkCardMarkdown,
} from 'markdown-link-card'

const linkCard = useLinkCardMarkdown()
const text = ref('')
const done = ref(false)

const content = computed(() =>
  markdownWithLinkCardTagPlaceholder(text.value, !done.value),
)
</script>

<template>
  <MarkdownRender
    v-bind="linkCard"
    :content="content"
    :final="done"
  />
</template>

Fenced blocks show an inline skeleton until parsing completes; custom tags rely on markdownWithLinkCardTagPlaceholder for placeholder nodes.

Theming

Override appearance with CSS variables:

.link-card {
  --mlc-radius: 12px;
  --mlc-border-color: #e5e7eb;
  --mlc-bg: #fff;
  --mlc-title-color: #111827;
  --mlc-desc-color: #6b7280;
}

See src/styles/theme.css (copied to dist/theme.css on build).

API

ExportDescription
LinkCardLink preview card component
LinkCardRendererMarkdown node renderer
LinkCardSkeletonLoading skeleton
createMarkdownLinkCardPluginVue plugin
useLinkCardMarkdownComposable: Markdown integration props
getLinkCardMarkdownPropsSame as above (non-setup)
registerLinkCardRendererManual renderer registration
markdownWithLinkCardTagPlaceholderStreaming placeholder helper

License

MIT

Keywords

vue

FAQs

Package last updated on 25 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts