From 480c8b9e2dc2f4586d75c9f0c311a73f60091ab8 Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Mon, 16 Jan 2023 22:42:08 +0200 Subject: [PATCH] Update README.md --- README.md | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 1ad27525..2e1d2def 100644 --- a/README.md +++ b/README.md @@ -100,26 +100,29 @@ For more information on these options, see [the comrak documentation](https://gi ### Plugins In addition to the possibilities provided by generic CommonMark rendering, Commonmarker also supports plugins as a means of -providing further niceties. For example: +providing further niceties. - code = <<~CODE - ```ruby - def hello - puts "hello" - end +#### Syntax Highlighter Plugin - CODE - - Commonmarker.to_html(code, plugins: { syntax_highlighter: { theme: "Inspired GitHub" } }) - - #

-    # def hello
-    #  puts "hello"
-    # end
-    # 
-    # 
+```ruby +code = <<~CODE + ```ruby + def hello + puts "hello" + end +CODE + +puts Commonmarker.to_html(code, plugins: { syntax_highlighter: { theme: "InspiredGitHub" } }) + +#

+# def hello
+# puts "hello"
+# end
+# 
+# 
+``` -You can disable plugins just the same as with options, by passing `nil`: +To disable this plugin, pass `nil`: ```ruby Commonmarker.to_html(code, plugins: { syntax_highlighter: nil }) @@ -127,6 +130,16 @@ Commonmarker.to_html(code, plugins: { syntax_highlighter: nil }) Commonmarker.to_html(code, plugins: { syntax_highlighter: { theme: nil } }) ``` +Available themes ([source](https://docs.rs/syntect/5.0.0/syntect/highlighting/struct.ThemeSet.html#implementations)): + +- base16-ocean.dark +- base16-eighties.dark +- base16-mocha.dark +- base16-ocean.light +- InspiredGitHub +- Solarized (dark) +- Solarized (light) + ## Output formats Commonmarker can currently only generate output in one format: HTML.