# lexbor **Repository Path**: gentheaven/lexbor ## Basic Information - **Project Name**: lexbor - **Description**: myhtml 升级版, html 解析器 - **Primary Language**: C - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-02-26 - **Last Updated**: 2025-02-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Lexbor: Crafting a Browser Engine with Simplicity and Flexibility Why build yet another browser engine? There's a myriad of challenges developers face in fully utilizing modern web technologies. Parsing HTML and CSS, dealing with URLs and encodings often involves slow, resource-heavy implementations or outdated solutions. Even established solutions, written in C++ and reaching tens of megabytes in volume, are often not versatile enough. Meanwhile, language-specific implementations for Python, Node.js, Rust, or any other favorite of the day are slow and prone to lock-in. ### The Core Requirements Lexbor's core requirements rose from the ashes of these challenges: #### Portability Lexbor aims to adapt to different platforms and integrate into various programming languages. It's not yet another library full of quirks and idiosyncrasies; Lexbor aims to offer developers flexibility to incorporate it into their work directly, regardless of the programming language they chose. #### Modularity Lexbor wants to keep things simple: Developers should be able to use only the parts they need. Whether it's an HTML or URL parser, the engine's code should be straightforward and easy to navigate, promoting rapid development. #### Speed In a nutshell, Lexbor wants things to happen *real fast*. It's not just about making a browser engine; it's about making sure that *everything*, even the most resource-intensive tasks such as HTML parsing, occur swiftly to meet the real-time demands of modern web applications. #### Independence Lexbor empowers developers by giving them full control over algorithms, resources, and dimensions. By eliminating on external dependencies, we let developers customize the engine without sacrificing performance or features. #### Compliance Lexbor commits to industry standards. Developers need to be sure that the code aligns with widely established specifications. The output of Lexbor's modules, be it HTML, CSS, URLs, or others, should match that of modern browsers, meeting industry specifications. ### Origin Story Having had all these goals in mind for about a decade, Alexander Borisov, whose name gave the project its title, came up with the idea of a browser engine crafted entirely in C (there's no school like the old school). The language was chosen simply because we believed it could meet all the criteria seamlessly. Unlike heavyweights such as WebKit or Blink, Lexbor takes a lean and focused approach, delivering a nimble yet powerful browser engine. All it takes is years of top-notch developer expertise. An important point to make: Lexbor doesn't stop at parsing and rendering modern HTML. It offers each component as a standalone entity, ready to be integrated into other people's projects. This approach sets us apart, providing a modular solution that not only meets browser needs but also empowers developers with versatile tools for their own web-related tasks. All in all, we envision Lexbor a promising player in the menagerie of browser technologies, pushing the boundaries and helping developers fully leverage modern web technologies. ## Features * [Modules](https://github.com/lexbor/lexbor/tree/master/source/lexbor). * [Single or separate](https://github.com/lexbor/lexbor#single-or-separately) libraries for each module. * No outside dependencies. * Easy to port to any platform. * C99 support. * Speed. ### HTML Module * Full conformance with the [HTML5 specification](https://html.spec.whatwg.org/multipage/). * Manipulation of [elements](https://github.com/lexbor/lexbor/blob/master/examples/lexbor/html/element_create.c) and [attributes](https://github.com/lexbor/lexbor/blob/master/examples/lexbor/html/element_attributes.c): add, change, delete and other. * Supports fragment parsing (for [innerHTML](https://github.com/lexbor/lexbor/blob/master/examples/lexbor/html/element_innerHTML.c)). * Supports parsing [by chunks](https://github.com/lexbor/lexbor/blob/master/examples/lexbor/html/document_parse_chunk.c). * Passes all tree construction tests. * [Tested](https://github.com/lexbor/warc_test) by 200+ million HTML pages with [ASAN](https://clang.llvm.org/docs/AddressSanitizer.html). * Two way for parsing HTML: [by Document](https://github.com/lexbor/lexbor/blob/master/examples/lexbor/html/document_parse.c), [by Parser](https://github.com/lexbor/lexbor/blob/master/examples/lexbor/html/parse.c). * Supports [determining encoding](https://github.com/lexbor/lexbor/blob/master/examples/lexbor/html/encoding.c) by byte stream. * [Parsing CSS Styles](https://github.com/lexbor/lexbor/tree/master/examples/lexbor/styles) in tag attributes and in the `