Implements src/lib/core/ per docs/04 and docs/05: model, timestamps, normalize-url, csv-path, detect-format, three parsers, four serializers, dedupe and diff. 175 tests, 97% statements / 91% branches on core, well over the 90/90/85 gate. `npm run verify` green. The flagship round-trip suite asserts `parse(serialize(t)).roots deepEquals project(t, format)` with zero warnings, across sample trees, every browser fixture and 200 seeded random trees per format — 600 round-trips, with a nasty-title pool covering quotes, commas, CR/LF, emoji, RTL, `</a>` and path slashes. Seven defects found by an adversarial review pass and fixed here, each with a regression test: - normalize-url rebuilt a bare-origin key from protocol+host, discarding userinfo — https://alice@host/ and https://bob@host/ collapsed to one key, so one of them would be silently dropped on import. - The Netscape walk picked a single root <DL>. Against the real Safari shape (top-level <DT><H3> with no wrapper, Mozilla bug 801450) that returns the first folder's INNER list and reports a clean parse having dropped every other top-level folder. Replaced with a document-order pass over <body> that accepts both entry-point kinds, skipping child lists already consumed via an explicit </DT> so subtrees are not emitted twice. The old test named this case but its fixture had a wrapper, so the branch was never exercised. - escapeHtml emitted CR verbatim; the HTML tokenizer normalizes CR/CRLF to LF before character references are decoded, so any title carrying \r from BM JSON or a quoted CSV field was mutated by an HTML round trip. - joinPath(['']) collapsed to '', indistinguishable from "no path", so a folder with an empty title dissolved on CSV re-import. - parseCsv counted only bookmark rows against MAX_NODES, so folders synthesized from deep paths bypassed the cap entirely. - detect-format required a literal unquoted `folder_path` prefix and so rejected fully quoted headers that parseCsv itself accepts; both now share one matcher. - Markdown formatUrl encoded `>` but not `<` or line endings, producing an angle-bracket destination CommonMark rejects. docs/04 §1.2 is corrected too: its stated fallback ("walk the top-level <DT> children of body") is itself lossy on files that mix a wrapper with loose <DT>s. Also adds .gitattributes so fixture CRLF survives a clone — EOL normalization would otherwise make a fresh checkout test different bytes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
12 lines
470 B
HTML
12 lines
470 B
HTML
<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
|
<TITLE>Bookmarks</TITLE>
|
|
<H1>Bookmarks</H1>
|
|
<DL><p>
|
|
<DT><H3 ADD_DATE="1700100000" LAST_MODIFIED="1751600000" PERSONAL_TOOLBAR_FOLDER="true">Favorites bar</H3>
|
|
<DL><p>
|
|
<DT><A HREF="https://www.bing.com/" ADD_DATE="1700100001">Bing</A>
|
|
<DT><A HREF="file:///C:/Users/Public/notes.txt" ADD_DATE="1700100002">Local notes</A>
|
|
</DL><p>
|
|
</DL><p>
|