home ~ projects ~ socials

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

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:

  1. syntax highlighting
  2. 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:

My apologies. The process I use to include alt text is currently broken. I'm working to get it fixed and hope to have it working again soon.

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

TODO

Next Phase

  • audio
  • blurb
  • canvas
  • data
  • details
  • dlist
  • ext (external process)
  • groups
  • head
  • images
  • include
  • iref
  • menu
  • object
  • ref
  • table
  • tabs
  • textarea
  • widget
-- end of line --