HTML parser library implemented in C99
  • HTML 58.3%
  • C 32.5%
  • C++ 4.1%
  • Ragel 3.6%
  • Python 1.2%
Find a file
2025-10-11 12:59:27 +03:00
benchmarks Add baidu benchmark which has been left out of the git repository all this time. 2015-02-18 00:24:35 -08:00
doc doc/maintaining.md: adjust update soname step to new library declaration (#12) 2025-08-26 02:15:59 +03:00
examples add examples build option to meson build system 2025-05-11 23:08:09 +03:00
fuzz add fuzz testing with libfuzzer 2025-07-06 20:00:40 +03:00
python/gumbo html5lib_adapter_test.py: Check html5lib test files were found 2025-10-04 09:03:32 +02:00
src support multiple option elements with selectedcontent 2025-10-11 12:59:27 +03:00
testdata@f994590f52 update html5lib-tests to f994590 2025-09-10 22:18:45 +03:00
tests support multiple option elements with selectedcontent 2025-10-11 12:59:27 +03:00
visualc/include return visualc/include/strings.h file 2023-09-24 20:01:09 +03:00
.clang-format Reformat the source code with clang-format, and add a config file for formatting preferences. 2015-04-30 17:35:26 -04:00
.gitignore add fuzz testing with libfuzzer 2025-07-06 20:00:40 +03:00
.gitmodules drop gyp build system support 2023-09-25 19:57:16 +03:00
autogen.sh add optional arguments to subcommands of autogen.sh script 2024-11-01 02:39:50 +03:00
CHANGES.md set version to 0.13.2 2025-08-26 03:13:50 +03:00
configure.ac set version to 0.13.2 2025-08-26 03:13:50 +03:00
Doxyfile set version to 0.13.2 2025-08-26 03:13:50 +03:00
gentags.sh replace gentags.py and genperf.py with gentags.sh 2025-01-11 01:07:09 +03:00
gumbo.pc.in Initial commit. 2013-08-09 11:25:49 -07:00
Makefile.am configure.ac: fix build without C++ (#28) 2025-06-26 12:30:19 +02:00
meson.build set version to 0.13.2 2025-08-26 03:13:50 +03:00
meson_options.txt add fuzz testing with libfuzzer 2025-07-06 20:00:40 +03:00
README.md set version to 0.13.2 2025-08-26 03:13:50 +03:00
setup.py set version to 0.13.2 2025-08-26 03:13:50 +03:00

Gumbo - HTML parser library implemented in C99

Gumbo is an implementation of the HTML5 parsing algorithm implemented as a pure C99 library with no outside dependencies. It's designed to serve as a building block for other tools and libraries such as linters, validators, templating languages, and refactoring and analysis tools. This repository adheres to all the original ideas of the archived GitHub repository, which has not seen any development since 2016.

Goals & features:

  • Fully conformant with the HTML5 spec.
  • Robust and resilient to bad input.
  • Simple API that can be easily wrapped by other languages.
  • Support for source locations and pointers back to the original text.
  • Support for fragment parsing.
  • Relatively lightweight, with no outside dependencies.
  • Passes all html5lib tests.
  • Tested on over 2.5 billion pages from Google's index.
  • Follows Semantic Versioning scheme.

Non-goals:

  • Execution speed. Gumbo gains some of this by virtue of being written in C, but it is not an important consideration for the intended use-case, and was not a major design factor.
  • Support for encodings other than UTF-8. For the most part, client code can convert the input stream to UTF-8 text using another library before processing.
  • Mutability. Gumbo is intentionally designed to turn an HTML document into a parse tree, and free that parse tree all at once. It's not designed to persistently store nodes or subtrees outside of the parse tree, or to perform arbitrary DOM mutations within your program. If you need this functionality, we recommend translating the Gumbo parse tree into a mutable DOM representation more suited for the particular needs of your program before operating on it.

Basic usage

#include <gumbo.h>

int main() {
	GumboOutput* output = gumbo_parse("<h1>Hello, World!</h1>");
	// Do stuff with output->root
	gumbo_destroy_output(&kGumboDefaultOptions, output);
}

A variety of sample programs can be found in the examples directory. To build them, enable the examples build option during setup, e.g.:

meson setup builddir -Dexamples=true

Learning more

Package availability

Packaging status