1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! # netscape_bookmark_parser
//!
//! ## Introduction
//!
//! `netscape_bookmark_parser` is a Rust crate designed to parse HTML bookmark files (commonly exported from web browsers) and convert them into a structured JSON format. This crate provides functionality to read, parse, and transform bookmark data, making it easier to work with bookmarks programmatically.
//!
//! ## Features
//!
//! - **HTML Bookmark Parsing**: The crate can parse HTML files that contain browser bookmarks, extracting folder structures and individual bookmarks.
//! - **Timestamp Conversion**: It handles the conversion of Unix timestamps to Windows NT timestamps, ensuring accurate date representation.
//! - **JSON Output**: The parsed data is converted into a JSON structure, which can be easily integrated into other applications or stored for further processing.
//! - **Error Handling**: Robust error handling ensures that issues with file paths or malformed HTML are gracefully managed.
//!
//! ## Usage
//!
//! To use `netscape_bookmark_parser`, you can add it as a dependency in your `Cargo.toml` file:
//!
//! ```sh
//! cargo add netscape_bookmark_parser
//! ```
//!
//! Then, you can call the `run` function to process an HTML bookmarks file and output the result as a JSON file:
//!
//! ```ignore
//! use netscape_bookmark_parser;
//!
//! fn main() -> std::io::Result<()> {
//! netscape_bookmark_parser::run("input.html", "output_directory")?;
//! Ok(())
//! }
//! ```
//! ### install as CLI
//! ```sh
//! cargo install netscape_bookmark_parser
//! # example
//! netscape_bookmark_parser -d html2json -i .\bookmark.html -o ./
//! netscape_bookmark_parser -d json2html -i .\bookmark.json -o ./
//! ```
//!
//!