bookmarked
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

bookmarked 🔖

GitHub npm

Coverage Lines of Code Vulnerabilities

A tiny (dependency free!) library for building bookmark files.

bookmarked supports ES Modules (ESM) and CommonJS (CJS) - so it'll be wherever you need it.

How to install

$ npm i bookmarked

How to use

Single level deep bookmarks

import { bookmarked } from "bookmarked";

const bookmarks = [
  {
    href: "https://www.blackgirlscode.com/",
    name: "Black Girls Code, BlackGirlsCode, Women of Color in Technology",
  },
  {
    href: "https://www.freecodecamp.org/",
    name: "Learn to Code — For Free — Coding Courses for Busy People",
  },
];

const html = bookmarked(bookmarks);
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
      It will be read and overwritten.
      DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL>
  <P>
    <DT>
      <A HREF="https://www.blackgirlscode.com/">Black Girls Code, BlackGirlsCode, Women of Color in Technology</A>
    </DT>
    <DT>
      <A HREF="https://www.freecodecamp.org/">Learn to Code — For Free — Coding Courses for Busy People</A>
    </DT>
  </P>
</DL>

Bookmarks inside folders

[
  {
    name: "Learn to code",
    children: [
      {
        href: "https://www.blackgirlscode.com/",
        name: "Black Girls Code, BlackGirlsCode, Women of Color in Technology",
      },
      {
        href: "https://www.freecodecamp.org/",
        name: "Learn to Code — For Free — Coding Courses for Busy People",
      },
    ],
  },
];
...
<DL>
  <P>
    <DT>
      <H3>Learn Programming</H3>
    </DT>
    <DL>
      <P>
        <DT>
          <A HREF="https://www.blackgirlscode.com/">Black Girls Code, BlackGirlsCode, Women of Color in Technology</A>
        </DT>
        <DT>
          <A HREF="https://www.freecodecamp.org/">Learn to Code — For Free — Coding Courses for Busy People</A>
        </DT>
      </P>
    </DL>
  </P>
</DL>

Folders inside folders

[
  {
    name: "Programming",
    children: [
      {
        name: "Learn Programming",
        children: [
          {
            href: "https://www.blackgirlscode.com/",
            name:
              "Black Girls Code, BlackGirlsCode, Women of Color in Technology",
          },
          {
            href: "https://www.freecodecamp.org/",
            name: "Learn to Code — For Free — Coding Courses for Busy People",
          },
        ],
      },
      {
        name: "JavaScript",
        children: [
          {
            href: "https://www.npmjs.com/",
            name: "npm",
          },
        ],
      },
    ],
  },
];
...
<DL>
  <P>
    <DT>
      <H3>Programming</H3>
    </DT>
    <DL>
      <P>
        <DT>
          <H3>Learn Programming</H3>
        </DT>
        <DL>
          <P>
            <DT>
              <A HREF="https://www.blackgirlscode.com/">Black Girls Code, BlackGirlsCode, Women of Color in Technology</A>
            </DT>
            <DT>
              <A HREF="https://www.freecodecamp.org/">Learn to Code — For Free — Coding Courses for Busy People</A>
            </DT>
          </P>
        </DL>
        <DT>
          <H3>JavaScript</H3>
        </DT>
        <DL>
          <P>
            <DT>
              <A HREF="https://www.npmjs.com/">npm</A>
            </DT>
          </P>
        </DL>
      </P>
    </DL>
  </P>
</DL>

Check out the test file for more examples

Package Sidebar

Install

npm i bookmarked

Weekly Downloads

16

Version

3.0.3

License

MIT

Unpacked Size

53.7 kB

Total Files

37

Last publish

Collaborators

  • pxlprfct