Skip to content

Jwhiles/marked-quotebacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Marked Quotebacks

This library exports an extension for the markedjs that adds support for Quotebacks.

The idea of this package is that you install it into your marked renderer, and then if your markdown files contain anything that matches the format of the quotes exported by quotebacks, then it will be rendered in the same way that we see in the existing marked.

The format of quotes

Add a quote like this to your markdown:

> Steven Spielberg's 'The Terminal' is the worst film I've ever watched.

Source: [Fear and Loathing of The Terminal](https://johnwhiles.com/posts/the-terminal) by John Whiles

and it will be rendered like this:

Screenshot 2023-02-13 at 18 59 46

How to use it

npm i marked-quotebacks
import { marked } from "marked";
import { quoteBack } from "marked-quotebacks";

marked.use({ extensions: [quoteBack] });

const html = marked(yourMarkdownInput);

The library also exports a css file under /dist/main.css which will make the quotebacks look the right way. Depending on how you build your website there are various ways to use the styles. I leave it up to you to work this out. You can also write your own css if you want the quotes to look different.

Notes / Known Issues

  • I wrote the regex that powers this by hand. It's probably wrong in lots of edge cases.
  • I've tried to use the same google favicon resizer API as the original quotebacks library, but it always returns 404s. I think I must be doing something wrong but I don't know what!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published