https://github.com/CWood-sdf/banana.nvim
Write your plugin ui in html
https://github.com/CWood-sdf/banana.nvim
neovim-plugin
Last synced: 8 days ago
JSON representation
Write your plugin ui in html
- Host: GitHub
- URL: https://github.com/CWood-sdf/banana.nvim
- Owner: CWood-sdf
- License: mit
- Created: 2024-02-03T20:36:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-10T00:32:38.000Z (10 days ago)
- Last Synced: 2025-04-10T01:30:57.876Z (10 days ago)
- Topics: neovim-plugin
- Language: Lua
- Homepage:
- Size: 55.5 MB
- Stars: 153
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-neovim-sorted - CWood-sdf/banana.nvim
- awesome-neovim-sorted - CWood-sdf/banana.nvim
README
# Banana.nvim
A blazingly fast html renderer for neovim
> [!CAUTION]
>
> This project is still in early development.
> Expect breaking changes and bugs, and please report any issues you encounter.> [!NOTE]
>
> If there is a css/html feature that is not currently implemented, please submit an issue and it should probably be implemented within a few days> [!NOTE]
>
> Banana only works on neovim version 0.10.0 and above## Example
This is the banana hello world:
```html
nml {
width: 75%;
height: 75%;
left: 12%;
top: 12%;
}
Hello World!
```
then in a lua file:
```lua
local instance = require('banana.instance').newInstance("stuff/foo", "random buffer name")
instance:open()
```or you can run the command `:BananaSo` inside that file for banana to automatically set up a testing instance
all of that code results in this window:

The file structure for this example can be seen below:
this may seem underwhelming as the above result can be done in a few lines of lua, but banana starts becoming extremely helpful when you start doing more complex rendering cases like nested tags, css grid display, or css flex display. For a better example, check out [banana-example](https://github.com/CWood-sdf/banana-example) or the other examples below
### Other examples
Currently there are four examples: a todo app, a partial clone of the lazy.nvim plugin ui, an example tree element, and a counter app.
The todo's files are contained in banana/example/todo.nml and lua/banana_example/todo.lua. You can run it with `require('banana').runTodo()`

The counter's files are contained in banana/example/counter.nml and lua/banana_example/counter.lua. You can run it with `require('banana').runCounter()`

Lazy's files are contained in banana/example/lazy/ and lua/banana_example/lazy/ and can be run with `require('banana').runLazy()`

The tree's files are contained in the same location as tree.nml and tree.lua and can be run with `require('banana').runTree()`

## Installation
> [!NOTE]
>
> Banana requires zig to be installed on your systemBanana can be installed like this in lazy:
```lua
return {
"CWood-sdf/banana.nvim",
opts = {
-- if set to false, then you must call require("banana").initTsParsers() somewhere else
-- this allows you to remove treesitter as a dependency so that you can continue lazy loading it
-- if set to true, then it auto creates the treesitter parsers and loads nvim-treesitter
setupTs = true,
},
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
}
```or it can be added as a dependency to your plugin.
There is no need to lazy load banana as all functionality inside the library is already lazy loaded
## Documenation
Please refer to the [banana wiki](https://github.com/CWood-sdf/banana.nvim/wiki) for documentation
## NEEDED DOCUMENTATION
- developing banana
- developing a banana plugin
- specifics about all the apis and stuff## Contributing
There is a lot of work still to be done. If you want to help out, the primary areas work is needed in are:
- table rendering
- documentation
- tests
- apis
- extensibilityIf you have a css/html feature that you really want implemented, post it in an issue and I will see what I can do. However, there are currently no plans to support jsx or the like because it will add a massive amount of complexity (in plugin dev's dx (lsp), my sanity (and dx), and probably the end user's experience too (perf issues)).
## Self promotion
Follow me on [x](https://x.com/CWood_sdf)
Try out my other two plugins: [spaceport](https://github.com/CWood-sdf/spaceport.nvim) and [pineapple](https://github.com/CWood-sdf/pineapple)
Follow me on github