npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

markdown-it-link-preview

v1.1.4

Published

Markdown-it plugin to include link preview in your document

Downloads

1,812

Readme

markdown-it-link-preview

Markdown-it plugin to include link preview in your document.

[@preview](https://github.com/junkawa/figma_jp)
<p><div class="link-preview-widget"><a href="https://github.com/junkawa/figma_jp" rel="noopener" target="_blank"><div class="link-preview-widget-title">junkawa/figma_jp</div><div class="link-preview-widget-description">Japanese Chrome Extension for figma. Contribute to junkawa/figma_jp development by creating an account on GitHub.</div><div class="link-preview-widget-url">GitHub</div></a><a class="link-preview-widget-image" href="https://github.com/junkawa/figma_jp" rel="noopener" style="background-image: url('https://repository-images.githubusercontent.com/292775522/57a0a600-f246-11ea-9b1a-078a5abb05e8');" target="_blank"></a></div></p>

Install

npm install markdown-it-link-preview --save

Use

const md = require('markdown-it')();
const linkPreview = require('markdown-it-link-preview');
md.use(linkPreview);
const result = md.render(
    '[@preview](https://github.com/junkawa/figma_jp)',
);

result
/*
<p><div class="link-preview-widget"><a href="https://github.com/junkawa/figma_jp" rel="noopener" target="_blank"><div class="link-preview-widget-title">junkawa/figma_jp</div><div class="link-preview-widget-description">Japanese Chrome Extension for figma. Contribute to junkawa/figma_jp development by creating an account on GitHub.</div><div class="link-preview-widget-url">GitHub</div></a><a class="link-preview-widget-image" href="https://github.com/junkawa/figma_jp" rel="noopener" style="background-image: url('https://repository-images.githubusercontent.com/292775522/57a0a600-f246-11ea-9b1a-078a5abb05e8');" target="_blank"></a></div></p>
*/

Syntax

[@preview](URL)

CSS sample

Screenshot

.link-preview-widget
{
    display: table;

    width: 100%;

    border: 1px solid #e6e6e6;
    border-radius: 4px;
}

.link-preview-widget-title
{
    font-size: 16px;
    font-weight: 700;

    display: -webkit-box;
    overflow: hidden;

    margin-bottom: 8px;

    word-break: break-all;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.link-preview-widget-description
{
    font-size: 12px;
    font-style: normal;
    line-height: 1.5;

    display: -webkit-box;
    overflow: hidden;

    max-height: 3em;
    margin-bottom: 4px;

    word-break: break-all;

    color: #787c7b;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.link-preview-widget-url
{
    font-size: 12px;
    font-style: normal;
    line-height: 1.5;

    display: block;

    margin-bottom: 0;

    color: #222;
}

.link-preview-widget > a
{
    display: table-cell;
    flex-direction: column;

    padding: 16px;

    cursor: pointer;
    vertical-align: middle;
    text-decoration: none;

    color: inherit;
    background-color: transparent;

    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-box-flex: 1;
    flex: 1;
}

.link-preview-widget-image
{
    width: 225px;
    min-width: 220px;
    height: 150px;
    padding: 0;

    vertical-align: middle;

    border-left: 1px solid #f2f2f2;
    border-radius: 0 3px 3px 0;
    background-repeat: no-repeat;
    background-position: 50%;
    background-size: cover;

    -webkit-box-flex: 0;
    flex: 0;
}