• skip to sidebar
  • skip to search box

trainedmonkey

by Jim Winstead Jr.

Entries tagged 'YAML'

Taste the rainbow

A rainbow in the distance over the ocean in Hawai’i.

When I added the support for dark mode, I had to add a little support to the syntax highlighting styles so they looked okay in both light and dark modes.

Today I went in and worked on the JavaScript code a bit to make it a little more modern and refined the styles a little bit more. I also added the language file for YAML, and built it out so it does a better job of highlighting some of YAML’s more special syntax.

I am sticking with this JavaScript-based syntax highlighting for now, mostly because it works.

Here is a YAML sample pulled from the 1.2.2 spec plus a couple of minor additions to show off additional syntax that is handled.

%YAML 1.2
--- !<tag:clarkevans.com,2002:invoice>
invoice: 34843
date   : 2001-01-23
bill-to: &id001
  given  : Chris
  family : Dumars
  address:
    lines: |
      458 Walkman Dr.
      Suite #292
    city    : Royal Oak
    state   : MI
    postal  : 48046
ship-to: *id001
product:
- sku         : BL394D
  quantity    : 4
  description : Basketball
  price       : 450.00
- sku         : BL4438H
  quantity    : 1
  description : Super Hoop
  price       : 2392.00
tax  : 251.42
total: 4443.52
shipped:
  - false
comments:
  Late afternoon is best.
  Backup contact is Nancy
  Billsmer @ 338-4338.
» Saturday, June 1, 2024 @ 4:34pm » code, blogging, fads, syntax highlighting, YAML » Bluesky butterfly logo » Comment
  • Home
  • About
  • Archive
  • Bookmarks
  • Photos
  • Projects
  • GitHub
  • @jimw@mefi.social

Dedicated to the public domain by Jim Winstead Jr.