Neopolitan Tree-Sitter Parser, Syntax Highlighter, And Inline Code Runner

Heads-Up

Head's up that this is still very much a "works on my machine" level project.

Introduciton

Neopolitan is the plain-text format I designed to manage website content. This page is the documentation for an accompaning tree-sitter plugin.

The plugin offers two features:

  • syntax highlighting

  • inline code block execution

Syntax Highlighting

Highlighting for the primary sections is in place. I don't use much highlighting for the core of the docs, but I've got code blocks set up to highlight properly for whatever language they are. Here's a sample:

A screenshot of a text document with the title Neopolitan Syntax Highlighting at the top. The background is a dark gray. The majority of the text is white with difference sections showing computer code that's highlighted in multiple colors

Inline Code Block Execution

I've got a prototype Neovim plugin working that executes code blocks inside files and drops the output back into the file (similar to emacs org-mode). Here's what that looks like:

Usage

This code is still under initial development and I havent' looked up yet how to put things in place properly.

For now, I put the parser in place on my mac by editing:

~/Library/Application Support/tree-sitter/config.json

and add a "parsers-directories" array item that point to the local src tree (e.g.

/Users/alan/workshop/tree-sitter-neopolitan/src

For the plugin, I created a symbolic link in `~/.config/nvim/after/plugin`` that points to the repos `plugin/after/plugin/execute_code_block.lua

The Repo

The repo is here if you're interested:

tree-sitter-neopolitan

Progress Report

This is the list of Neopolitan sections and which ones have been implement in the parser

Next Phase

  • audio

  • blurb

  • canvas

  • data

  • details

  • dlist

  • ext (external process)

  • groups

  • head

  • images

  • include

  • iref

  • menu

  • object

  • ref

  • table

  • tabs

  • textarea

  • widget