Welcome Guest, Not a member yet? Register   Sign In
Markdown Pages for CodeIgniter 4
#1

This library allows you to use Markdown files as pages in your CodeIgniter 4 application. It dynamically converts Markdown content to HTML and serves it as web pages, making it ideal for static content like documentation or simple sites.

GitHub Repository: codeigniter-markdown-pages

Installation:
Code:
composer require michalsn/codeigniter-markdown-pages

Example Usage:
PHP Code:
$markdownPages  service('markdownpages'APPPATH 'Views/markdown');
$file $markdownPages->file('first-steps/second-file');
// returns "Second File"
$file->getName();
// returns parsed markdown
$file->parse()->getContent();
// returns parsed meta from YAML part of the file

$file->parse()->getMeta(); 

Docs:

https://michalsn.github.io/codeigniter-markdown-pages/
Reply
#2

I ran into this post at a time I was looking for a CI4 alternative to laravel-markdown. Awesome news.

Does it also feature a solution for code syntax highlighting?

CodeIgniter Wizard (CRUD code generator for Mac) instantly scaffolds Bootstrap-based web applications with an administrative interface (admin templates include Bootstrap5)

Reply
#3

By default, it uses the League CommonMark parser. But you can use a different parser or extension for CommonMark, like Github-Flavored Markdown.

I will try to add an example to the docs tomorrow.
Reply
#4

(12-31-2024, 08:58 AM)gosocial2 Wrote: I ran into this post at a time I was looking for a CI4 alternative to laravel-markdown.

Oh... it's not really an alternative. This package only works with static files.

If you want to parse markdown you can just use CommonMark parser alone. Create a service and use it - simple as that.

In case anyone needs to use a different parser, here is an example of how to set it up: https://michalsn.github.io/codeigniter-m...extending/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB