{"id":13580107,"url":"https://github.com/twilco/kosmonaut","last_synced_at":"2025-05-16T03:02:05.012Z","repository":{"id":38334827,"uuid":"202060742","full_name":"twilco/kosmonaut","owner":"twilco","description":"A web browser engine for the space age :rocket:","archived":false,"fork":false,"pushed_at":"2023-06-21T22:41:42.000Z","size":1761,"stargazers_count":1703,"open_issues_count":25,"forks_count":32,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-05-13T19:02:37.194Z","etag":null,"topics":["browser","web"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twilco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-08-13T03:56:03.000Z","updated_at":"2025-05-02T09:46:35.000Z","dependencies_parsed_at":"2024-01-06T07:49:38.321Z","dependency_job_id":"86679200-e8b3-4a26-bf93-17f7f33cad08","html_url":"https://github.com/twilco/kosmonaut","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilco%2Fkosmonaut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilco%2Fkosmonaut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilco%2Fkosmonaut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilco%2Fkosmonaut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twilco","download_url":"https://codeload.github.com/twilco/kosmonaut/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459077,"owners_count":22074604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","web"],"created_at":"2024-08-01T15:01:47.370Z","updated_at":"2025-05-16T03:02:04.909Z","avatar_url":"https://github.com/twilco.png","language":"Rust","readme":"![Kosmonaut banner](img/Kosmonaut_Banner_1200x400-01.png)\n\n---\n\n[![Build Status](https://travis-ci.com/twilco/kosmonaut.svg?branch=master)](https://travis-ci.com/twilco/kosmonaut) [![Join the chat at https://gitter.im/kosmonaut-browser/community](https://badges.gitter.im/kosmonaut-browser/community.svg)](https://gitter.im/kosmonaut-browser/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nKosmonaut is a web browser engine created to serve as the vehicle for your journey across the world wide web.\n\n\u003e The road to the stars is steep and dangerous.  But we're not afraid...space flights can't be stopped.\n\u003e \n\u003e ― Yuri Gagarin\n\n### What can Kosmonaut do?\n\nSo far, not much.  Only a very limited subset of CSS is currently supported, so most web pages will not work.  However, given very basic HTML and CSS, Kosmonaut does render the right things — see Kosmonaut's rendering of [this code](https://github.com/twilco/kosmonaut/blob/eef5274c252038062049769861d02354cbaa4b2a/web/rainbow-divs-incl-css.html), compared with that of Firefox:\n\n![Kosmonaut and Firefox rendering HTML and CSS the same, resulting in a picture of some rainbow colored boxes.](img/rainbow-divs-vs-firefox.png)\n\nHere is a summary of things Kosmonaut can do, things I'm currently working on, and things that are towards the front of the todo list.\n\n- [x] Parse HTML and small subset of CSS into DOM and rules, cascade CSS and apply to DOM\n- [x] Layout and paint of normal flow, non-replaced block-level boxes.\n    - [x] Support\u003csup id=\"a1\"\u003e[1](#f1)\u003c/sup\u003e for [abstract box layout](https://drafts.csswg.org/css-writing-modes-4/#abstract-layout) with `writing-mode` and `direction` properties\n- [x] [Layout-tree-dump snapshot-based testing](https://github.com/twilco/kosmonaut/blob/c1bcb1aa858309e387c6d33e2fa6a698d07839a5/tests/layout/directional/snapshots/lib__layout__directional__ltr_vertical_lr_block_boxes_top_left_right_mbp_applied_physically.snap#L5) and [auto-discovering ref-tests](https://github.com/twilco/kosmonaut/blob/master/tests/lib.rs#L13#L25)\n- [x] Support for arbitrary scale factors (e.g. high-DPI monitors)\n- [x] Text rendering (without actual integration into layout — see next item)\n- [ ] Layout of basic non-replaced inline-level content (such as text)\n\n\u003cb id=\"f1\"\u003e1:\u003c/b\u003e Orthogonal flows ([see spec](https://drafts.csswg.org/css-writing-modes-4/#orthogonal-flows)) not supported. \nMixed `writing-mode` support in general (including parallel flows) is currently iffy — I recommend simply using `* { writing-mode: \u003cval\u003e }`. [↩](#a1)\n\n### Project goals\n\nKosmonaut was created with the intention of learning browser engine development.  However, the project has come a little ways now, and I've been thinking about niches I can work towards fitting Kosmonaut into.  I've shared some thoughts on potential niches [in this issue](https://github.com/twilco/kosmonaut/issues/6), and would love to hear your ideas too. \n\n### Build and test\n\nKosmonaut is built with Rust using OpenGL bindings via [gl-rs](https://github.com/brendanzab/gl-rs), [Glutin](https://github.com/rust-windowing/glutin) for window management and OpenGL context creation, Servo's [html5ever](https://github.com/servo/html5ever) and [cssparser](https://github.com/servo/rust-cssparser) for HTML and CSS parsing, and various other auxiliary libraries.\n\nTo build from source:\n\n1. Install Rust: https://www.rust-lang.org/tools/install\n2. Install native dependencies, most of which are required for FreeType which Kosmonaut uses for text rendering.\n    * Windows 10, MacOS\n        * Skip this step (Kosmonaut uses [font-kit](https://github.com/servo/font-kit), which uses the native font APIs for Windows and MacOS).\n    * Ubuntu\n        * Install the dependencies found in [this Dockerfile](docker/Dockerfile-ubuntu) on your machine (the `apt-get install` bit).\n    * Arch Linux \n        * Install the dependencies found in [this Dockerfile](docker/Dockerfile-arch) on your machine (the `pacman -Syu` bit).\n    * For those running on other operating systems, you'll need to install the equivalent packages.  I'd love to get more documentation on installation for other systems, so open an issue if you have trouble or if you'd like to share your setup process.\n3. `cargo build`\n\nTo render HTML and CSS with Kosmonaut, either pass files (HTML and optionally CSS):\n\n`cargo run -- tests/websrc/rainbow-divs.html`\n\nor a URL:\n\n`cargo run -- https://twilco.github.io/assets/html/rainbow-divs.html`\n\nTo run the tests, both unit and layout, execute:\n\n`cargo test --all`\n\nFor layout tests, Kosmonaut transforms the given HTML and CSS into a box tree, lays it out, and dumps it as text.  Those text snapshots are verified with [insta](https://docs.rs/insta/latest/insta/index.html).\n\nIf you need to review / update layout snapshots, it is helpful to install the Cargo insta CLI tool like so:\n\n`cargo install cargo-insta`\n\nKosmonaut can also run ref-tests.  Ref-tests render two HTML files and compares the result pixel-by-pixel, ensuring they are the same.\nThis is useful in lots of scenarios, such as testing that shorthands render the same as their longhand equivalents.\n \n### License and credits\n\nKosmonaut's current implementation is heavily inspired by [Servo](https://github.com/servo/servo), sometimes taking code directly from it.  Thus, Kosmonaut is licensed with the [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/).\n\nKosmonaut also takes inspiration from [Robinson](https://github.com/mbrubeck/robinson).  Thanks to [mbrubeck](https://github.com/mbrubeck) for their great series of articles on browser engines.\n\nFinally, Kosomonaut's DOM implementation was taken from [Kuchiki](https://github.com/kuchiki-rs/kuchiki) and has been slightly modified to fit our needs.\n","funding_links":[],"categories":["Rust","Open Source Web Browsers/Browser Engines","Rust (42)"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilco%2Fkosmonaut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwilco%2Fkosmonaut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilco%2Fkosmonaut/lists"}