Example of code highlight with geshi in markdown files
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
build/posts
img
posts
src
.gitignore
README.md
_bootstrap.php
build_posts.php
composer.json
composer.lock
index.php

README.md

Markdown + Geshi example

There is example of usage markdown and geshi code highlighter for blog posts.

Related article: http://antonshell.me/post/markdown-geshi-highlight

GeSHi - Generic Syntax Highlighter, written in PHP https://github.com/GeSHi/geshi-1.0

Markdown parser: https://github.com/erusev/parsedown

Demo

Code higlight example:

markdown_geshi_example

Demo available here: http://demo.antonshell.me/markdown_geshi_example/

Setup

1 . Clone repository

git clone ...

2 . Install dependencies

composer install 

3 . Build posts

php build_posts.php

Usage:

1 . Build posts

php build_posts.php

2 . See posts

http://127.0.0.1:8100/index.php?url=demo-markdown
http://127.0.0.1:8100/index.php?url=elastic-search-nginx-proxy

How it works:

1 . You create post in markdown format. See posts folder

2 . Add code blocks with specific language. For example:

<?php

return [
    'vendor' => 'Company',
    'module_name' => 'Filters',
    'module_name_underscore' => 'DIY_Filters',
    'view_path' => 'filters',
    'entity' => 'Filter',
    'view_path_ucf' => 'Filters',
    'entity_lower' => 'filter',
    'setup_version' => '1.0.0',
    'table_name' => 'company_filter',
];

3 . Run console command.

php build_posts.php

Html files will be generated in build/posts folder

4 . Then you can show them in your blog pages

$urlPath = __DIR__ . '/build/posts/demo-markdown.html';
require $path;