{ lib, pkgs, }: bookmarks: let indent = level: lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level)); bookmarkToHTML = indentLevel: bookmark: '' ${indent indentLevel}
${lib.escapeXML bookmark.name}''; directoryToHTML = indentLevel: directory: '' ${indent indentLevel}
${ if directory.toolbar then ''

Bookmarks Toolbar'' else "

${lib.escapeXML directory.name}" }

${indent indentLevel}

${allItemsToHTML (indentLevel + 1) directory.bookmarks} ${indent indentLevel}

''; itemToHTMLOrRecurse = indentLevel: item: if item ? "url" then bookmarkToHTML indentLevel item else directoryToHTML indentLevel item; allItemsToHTML = indentLevel: bookmarks: lib.concatStringsSep "\n" (map (itemToHTMLOrRecurse indentLevel) bookmarks); bookmarkEntries = allItemsToHTML 1 bookmarks; in pkgs.writeText "firefox-bookmarks.html" '' Bookmarks

Bookmarks Menu

Bookmarks Toolbar

${bookmarkEntries}

''