-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
153 lines (131 loc) · 6.18 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.12.2">
<meta name="crystal_docs.project_version" content="main">
<meta name="crystal_docs.project_name" content="wombat">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/doc.js"></script>
<meta name="repository-name" content="wombat">
<title>wombat main</title>
<script type="text/javascript">
CrystalDocs.base_path = "";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="index.html">
wombat
</a>
</h1>
<span class="project-version">
main
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent " data-id="wombat/Wombat" data-name="wombat">
<a href="Wombat.html">Wombat</a>
<ul>
<li class=" " data-id="wombat/Wombat/Error" data-name="wombat::error">
<a href="Wombat/Error.html">Error</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1><a id="wombat" class="anchor" href="#wombat"> <svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Wombat</h1>
<p>Wombat is a Crystal binding for the well-known <a href="https://github.com/sharkdp/bat">bat</a> syntax highlighting library. <code>bat</code> is a <code>cat(1)</code> clone with wings, popular among developers for its syntax highlighting capabilities. With Wombat, you can utilize <code>bat</code>'s syntax highlighting functionality directly within your Crystal applications.</p>
<h2><a id="about-bat" class="anchor" href="#about-bat">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>About <code>bat</code></h2>
<ul>
<li><a href="https://github.com/sharkdp/bat">bat</a>: A well-known <code>cat(1)</code> clone with syntax highlighting capabilities.</li>
<li><a href="https://github.com/kojix2/bat-c">bat-c</a>: A C wrapper for the <code>bat</code> library.</li>
</ul>
<h2><a id="installation" class="anchor" href="#installation">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Installation</h2>
<ol>
<li>
<p><strong>Add the dependency to your <code>shard.yml</code>:</strong></p>
<pre><code class="language-yaml">dependencies:
wombat:
github: kojix2/wombat</code></pre>
</li>
<li>
<p><strong>Install the dependencies:</strong></p>
<pre><code class="language-sh">shards install</code></pre>
</li>
</ol>
<p>During installation, a <code>postinstall</code> script will automatically download the static library for <code>bat-c</code> into the <code>src/ext</code> directory.</p>
<h2><a id="usage" class="anchor" href="#usage">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Usage</h2>
<h3><a id="obtain-a-syntax-highlighted-string" class="anchor" href="#obtain-a-syntax-highlighted-string">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Obtain a Syntax Highlighted String</h3>
<p>Retrieve and output a syntax highlighted string:</p>
<pre><code class="language-crystal"><span class="k">require</span> <span class="s">"wombat"</span>
highlighted <span class="o">=</span> <span class="t">Wombat</span>.pretty_string(<span class="s">%{puts "hello world"}</span>)
puts highlighted</code></pre>
<h3><a id="output-a-syntax-highlighted-file" class="anchor" href="#output-a-syntax-highlighted-file">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Output a Syntax Highlighted File</h3>
<p>Output the contents of a file with syntax highlighting. <code>bat</code> will automatically invoke <code>less</code>:</p>
<pre><code class="language-crystal"><span class="k">require</span> <span class="s">"wombat"</span>
<span class="t">Wombat</span>.pretty_print_file(<span class="s">"/path/to/your_file.cr"</span>)</code></pre>
<p>For more details, refer to the <a href="https://kojix2.github.io/wombat/">API Documentation</a>.</p>
<h2><a id="development" class="anchor" href="#development">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Development</h2>
<p>Sustainable development is important. If you encounter any issues or have suggestions for improvement, please contribute!</p>
<h2><a id="contributing" class="anchor" href="#contributing">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Contributing</h2>
<p>Your contributions are always welcome! Feel free to raise issues, submit pull requests, or suggest new features.</p>
</div>
</body>
</html>