1. Go to this page and download the library: Download tetrode/chalkmark library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tetrode / chalkmark example snippets
use Chalkmark\Chalkmark;
renderer->displayFile(__DIR__ . '/README.md', STDOUT);
use Chalkmark\Chalkmark;
$colors = [
'h1' => "\033[1;34m", // bright blue bold
'bullet' => "\033[36m", // cyan for list bullets
'code_inline' => "\033[33m", // yellow for inline code
// set any color key to '' (empty) to remove coloring for that element
];
$renderer = new Chalkmark($enableColors = true, 'default', $colors);
// Disable all colors (useful for logs or tests):
$rendererNoColor = new Chalkmark(false);
use Chalkmark\Chalkmark;
// Use the built-in monochrome theme but keep colors enabled (no ANSI will be emitted):
$renderer = new Chalkmark(true, 'monochrome');
// Use default theme but override some keys:
$overrides = [
'h1' => "\033[1;34m", // bright blue bold
'bullet' => "\033[36m", // cyan
];
$renderer = new Chalkmark(true, 'default', $overrides);
// Use reversed theme: like default but headers (h1..h6) use bright white (no bold)
// on colored backgrounds (red, green, yellow, blue, magenta, cyan).
// The background bar will expand to the terminal width (from $COLUMNS),
// or to max(60, header length) if the terminal width is unknown.
$renderer = new Chalkmark(true, 'reversed');
use Chalkmark\Chalkmark;
use Chalkmark\Theme\ThemeRegistry;
ph with *italic*, **bold**, and `inline code`.
- Bullet one
- Bullet two
MD;
foreach (ThemeRegistry::listBuiltins() as $name) {
echo "\n==== Theme: {$name} ====\n";
$renderer = new Chalkmark(true, $name);
echo $renderer->renderString($sample);
}
use Chalkmark\Theme\ThemeRegistry;
ThemeRegistry::register('mytheme', [
'h1' => "\033[1;35m",
'text' => "\033[0m",
// ... other keys
]);
$renderer = new Chalkmark(true, 'mytheme');