README

Readme

A Makeup lexer for CSS

Installation

The package can be installed by adding makeup and makeup_ts in mix.exs:

def deps do
  [
    {:makeup, "x.y.z"},
    {:makeup_ts, "x.y.z"}
  ]
end

Documentation can be found at https://hexdocs.pm/makeup_ts.

Changes

Refer to the Changelog.

Quickstart

Adding the library will make the lexer application for the lexer start automatically.

At that point, you can call

Makeup.highlight("""
const foo: Foo = 'bar'

const square =<T extends number>(param: T): T => param * param 

/* etc. */
""")

To get the stylesheet, just

Makeup.stylesheet(style) # by default, the StyleMap.default style is used.

Basically, use makeup as normal, but you can pass in TypeScript now.

It works in hexdocs to:

const foo: Foo = 'bar'

const square =<T extends number>(param: T): T => param * param 

/* etc. */

Usage with NimblePublisher

If you have a NimblePublisher-powered blog, you just have to tweak your markdown parsing settings:

use NimblePublisher
  build: MyApp.Blog.Post,
  from: Application.app_dir(:my_app, "priv/blog/**/*.md"),
  as: :posts,
  # ts and css added
  highlighters: [:makeup_elixir, :makeup_ts, :makeup_css]

Now, any code block declared as containing TypeScript should be highlighted.

Current state

This is very much a work-in-progress, but it higlights your TypeScrpt in a useful way.

Contributions are welcome.