/rouge-lexers-wenyan

Rouge 代码高亮库文言lang支持 Rouge lexer for Wenyan, programming language for the ancient Chinese

Primary LanguageRubyMIT LicenseMIT

rouge-lexers-wenyan

Rouge lexer for Wenyan, programming language for the ancient Chinese. Example

Installation

Add this line to your Gemfile:

gem 'rouge-lexers-wenyan'

Or run:

$ gem install rouge-lexers-wenyan

Usage

For Jekyll:

{% highlight wenyan %}
吾有一言。曰「「問天地好在」」。書之。
{% endhighlight %}

or use fenced code blocks in Markdown / Kramdown:

```wenyan
吾有一言。曰「「問天地好在」」。書之。
```

For Rouge CLI:

$ rougify highlight -r rouge-lexers-wenyan [...]

Besides wenyan, this lexer also supports wy and 文言 as aliases. .wy, .文言, .經, .篇, .章 and .書 are valid file extensions for Wenyan.

Features

  • Supports latest grammar (as of 2022)

  • Highlights JavaScript expressions in “identifiers”

  • Consistent with compiler behavior

    • namely, it handles quotation marks the same way as the compiler does

    • except for the 注曰*/ hack, which is too evil to support

Testing

After cloning the repository, run bundle exec rake to run the test (not “tests” as there is literally only one test, lmao), or run ruby bin/visual.rb (optionally followed by a theme name which defaults to thankful_eyes) to write a visual test to tmp/visual.html.