Skip to content

Commit 2655e21

Browse files
committed
docs: update programatic usage options
1 parent dca4f92 commit 2655e21

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,15 @@ use Ahc\CliSyntax\Highlighter;
100100
// PHP code
101101
echo new Highlighter('<?php echo "Hello world!";');
102102
// OR
103-
echo (new Highlighter)->highlight('<?php echo "Hello world!";');
103+
echo (new Highlighter)->highlight('<?php echo "Hello world!";', $options);
104104

105105
// PHP file
106-
echo Highlighter::for('/path/to/file.php');
106+
echo Highlighter::for('/path/to/file.php', $options);
107+
108+
// $options array is optional and can contain:
109+
[
110+
'lineNo' => true, // bool
111+
];
107112
```
108113

109114
#### Export
@@ -112,7 +117,14 @@ echo Highlighter::for('/path/to/file.php');
112117
use Ahc\CliSyntax\Exporter;
113118

114119
// PHP file
115-
Exporter::for('/path/to/file.php')->export('file.png');
120+
Exporter::for('/path/to/file.php')->export('file.png', $options);
121+
122+
// $options array is optional and can contain:
123+
[
124+
'lineNo' => true, // bool
125+
'font' => 'full/path/of/font.ttf', // str
126+
'size' => 'font size', // int
127+
];
116128
```
117129

118130
See [example usage](./example.php). Here's how the export looks like:

0 commit comments

Comments
 (0)