Symfony 5 bundle to easily create dynamic subpages with Markdown. Useful for help sections and wikis.

Overview

MarkdownWikiBundle

This bundle allows you to create rich subpages in a Symfony project using Markdown. Pages are stored in a file cache and sourced from an external directory, for example a Git submodule.

You can use this bundle to create help sections, information wikis or any other type of sub page, that is not supposed to be hardcoded into your Symfony codebase.

Features

  • Pages sourced from Markdown files
  • Page meta stored in separate YAML files
  • Multi-language support without constraints for locale codes
  • Custom implementations for parsing, storing and fetching pages

Requirements

  • Symfony 5.3+
  • PHP 8

Installation

composer require gigadrive/markdown-wiki-bundle

Configuration

This bundle is configured using standard Symfony bundle configuration.

# config/packages/markdown_wiki_bundle.yaml
markdown_wiki_bundle:
    source_directory: "%kernel.project_dir%/example-wiki/pages/"
  • source_directory defines a path to the directory holding your source files. These are the files that make up the content and data of your wiki. For best practice, use a Git submodule.

Usage

Once you have installed and configured the bundle, you need to create a file structure for your Markdown files. You can find an example wiki for help here.

The file structure within your wiki directory is held simple.

  • Every folder represents a level of your page's path.
  • Every folder for a page needs to contain two files, one called meta.yaml and one called content.md. If you wish to support multiple languages, name these files depending on your language code. For example for an English page, call them en.md and en.yaml
  • meta.yaml files need to contain the following keys: title The page's title description The page's description Any other keys will be passed on as "custom attributes". If you need any other data for a page, save it here.

Example: If you want to create a page with the path /account/creation, you would need a folder with the path /account/creation. In that folder, you would create a file named meta.yaml and a file named content.md. The first contains meta data about your page, the second contains your actual page content.

Serving pages

You can find an example Controller to serve pages here.

Customizing the parser

MarkdownWikiBundle is built using Parsedown, a free and open-source library to parse Markdown with PHP. This bundle registers Parsedown as a service (MarkdownWikiParser) and uses it for parsing. To overwrite parsing behavior, do the following:

First, create your own implementation of the parser:

namespace App\Service;

use Gigadrive\Bundle\MarkdownWikiBundle\Service\MarkdownWikiParser;

class ExampleParser extends MarkdownWikiParser {
    // TODO: Extend Parsedown
}

Now you have a class that extends Parsedown. Refer to Parsedown's documentation to extend parsing behavior in this new service. Once you are done, register your new parser by overwriting it in the Symfony container:

# config/services.yaml
services:
    app.parser:
        class: App\Service\ExampleParser

    markdownwiki.parser:
        alias: app.parser

Customizing the storage

By default, pages are cached in the Symfony file cache. This behavior can be overwritten using the MarkdownWikiStorageInterface. With this interface, you can create your own storage behavior and save cached pages in Redis, Doctrine or wherever you need.

To ensure that the bundle uses your storage and not the default one, the markdownwiki.storage container key needs to be overwritten:

# config/services.yaml
services:
    markdownwiki.storage.example:
        class: App\Service\YourStorageImplementation

    markdownwiki.storage:
        alias: markdownwiki.storage.example

Example Wiki

This bundle was created for the MCSkinHistory help section. You can find the source of it here to help you understand the intended structure for a wiki like this.

Rebuilding the caches

Whenever there is an update to the wiki pages, the internal caches of the bundle need to be rebuilt. This can be done by running the following console command, which comes with this bundle:

php bin/console wiki:rebuild-storage-cache

Caches can also be rebuilt programatically through the MarkdownWikiStorageService:

use Gigadrive\Bundle\MarkdownWikiBundle\Service\MarkdownWikiStorageService;

class ExampleService {
    public function __construct(
        protected MarkdownWikiStorageService $storageService
    ) {
    }

    public function rebuildCaches() {
        $this->storageService->rebuildStorageCache();
    }
}

Testing

This bundle uses PHPUnit as a testing framework.

When developing for this bundle, use the following commands to test its functionality:

git submodule update --init --recursive
composer install
php ./vendor/bin/phpunit

Copyright and License

This program was developed by Mehdi Baaboura and published by Gigadrive UG under the MIT License. For more information click here.

Comments
  • Bump symfony/framework-bundle from 5.3.10 to 5.3.15

    Bump symfony/framework-bundle from 5.3.10 to 5.3.15

    Bumps symfony/framework-bundle from 5.3.10 to 5.3.15.

    Release notes

    Sourced from symfony/framework-bundle's releases.

    v5.3.15

    Changelog (https://github.com/symfony/framework-bundle/compare/v5.3.14...v5.3.15)

    • no significant changes

    v5.3.14

    Changelog (https://github.com/symfony/framework-bundle/compare/v5.3.13...v5.3.14)

    • bug #44998 Allow default cache pools to be overwritten by user (Seldaek)
    • bug #44976 Avoid calling rtrim(null, '/') in AssetsInstallCommand (pavol-tk, GromNaN)

    v5.3.13

    Changelog (https://github.com/symfony/framework-bundle/compare/v5.3.12...v5.3.13)

    • bug #44682 alias cache.app.taggable to cache.app if using cache.adapter.redis_tag_aware (kbond)
    • bug #43164 Fix cache pool configuration with one adapter and one provider (fancyweb)
    • bug #44565 Use correct cookie domain in loginUser() (wouterj)
    • bug #44481 Fix loginUser() causing deprecation (wouterj)
    • bug #44427 Fix compatibility with symfony/security-core 6.x (deps=high tests) (wouterj)

    v5.3.11

    Changelog (https://github.com/symfony/framework-bundle/compare/v5.3.10...v5.3.11)

    • bug #44110 Fix default PHP attributes support in validation and serializer configuration when doctrine/annotations is not installed with PHP 8 (fancyweb)
    • bug #44108 remove FlattenExceptionNormalizer definition if serializer not available (kbond)
    • bug #44050 Fix package names (fabpot)
    • bug #43981 fix registering late resettable services (nicolas-grekas)
    Commits
    • fef224d Enable CSRF in FORM by default
    • 4437597 bug #44998 [FrameworkBundle] Allow default cache pools to be overwritten by u...
    • 67f5d9a Merge branch '4.4' into 5.3
    • a7c76d8 [FrameworkBundle] Allow default cache pools to be overwritten by user
    • 5ae3655 [FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand
    • 589155d Merge branch '4.4' into 5.3
    • a632944 Bump license year
    • 235ee15 fix test to actually use data provider
    • f765bc6 bug #44682 [FrameworkBundle] alias cache.app.taggable to cache.app if usi...
    • 81921ff alias cache.app.taggable to cache.app if using `cache.adapter.redis_tag_a...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump symfony/http-kernel from 5.3.10 to 5.3.12

    Bump symfony/http-kernel from 5.3.10 to 5.3.12

    Bumps symfony/http-kernel from 5.3.10 to 5.3.12.

    Release notes

    Sourced from symfony/http-kernel's releases.

    v5.3.12

    Changelog (https://github.com/symfony/http-kernel/compare/v5.3.11...v5.3.12)

    • no significant changes

    v5.3.11

    Changelog (https://github.com/symfony/http-kernel/compare/v5.3.10...v5.3.11)

    • bug #43501 fix ErrorException in CacheWarmerAggregate (Ahummeling)
    Commits
    • f53025c Update VERSION for 5.3.12
    • 7e7cf0c security #cve-2021-41267 [HttpKernel] Fix missing extra trusted header in sub...
    • 87baa86 Bump Symfony version to 5.3.12
    • cdccfda Update VERSION for 5.3.11
    • 7cc3b20 Merge branch '4.4' into 5.3
    • 39035d5 Never rely on dynamic properties
    • 57e54e9 Merge branch '4.4' into 5.3
    • 73636d9 Fix typos
    • 31b284c Merge branch '4.4' into 5.3
    • 2ac1ef6 bug #43501 [HttpKernel] fix ErrorException in CacheWarmerAggregate (Ahummeling)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump twig/twig from 3.3.3 to 3.3.8

    Bump twig/twig from 3.3.3 to 3.3.8

    Bumps twig/twig from 3.3.3 to 3.3.8.

    Changelog

    Sourced from twig/twig's changelog.

    3.3.8 (2022-02-04)

    • Fix a security issue when in a sandbox: the sort filter must require a Closure for the arrow parameter
    • Fix deprecation notice on round
    • Fix call to deprecated convertToHtml method

    3.3.7 (2022-01-03)

    • Allow more null support when Twig expects a string (for better 8.1 support)
    • Only use Commonmark extensions if markdown enabled

    3.3.6 (2022-01-03)

    • Only use Commonmark extensions if markdown enabled

    3.3.5 (2022-01-03)

    • Allow CommonMark extensions to easily be added
    • Allow null when Twig expects a string (for better 8.1 support)
    • Make some performance optimizations
    • Allow Symfony translation contract v3+

    3.3.4 (2021-11-25)

    • Bump minimum supported Symfony component versions
    • Fix a deprecated message
    Commits
    • 972d860 Prepare the 3.3.8 release
    • b265233 Merge branch '2.x' into 3.x
    • fca80b5 Bump version
    • 66baa66 Prepare the 2.14.11 release
    • 9e5ca74 Merge branch '2.x' into 3.x
    • 22b9dc3 bug #3641 Disallow non closures in sort filter when the sanbox mode is enab...
    • 2eb3308 Disallow non closures in sort filter when the sanbox mode is enabled
    • 25d410b Merge branch '2.x' into 3.x
    • e056e63 bug #3638 Fix call to deprecated "convertToHtml" method (jderusse)
    • 779fdd0 Fix call to deprecated "convertToHtml" method
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Basic controller for handling requests and serving pages

    Basic controller for handling requests and serving pages

    Add a basic controller that implements a way to handle HTTP requests and serve pages. This could also serve as a good example on how to implement pages into an existing project.

    documentation enhancement 
    opened by Zeryther 0
  • Bump twig/twig from 3.3.8 to 3.4.3

    Bump twig/twig from 3.3.8 to 3.4.3

    Bumps twig/twig from 3.3.8 to 3.4.3.

    Changelog

    Sourced from twig/twig's changelog.

    3.4.3 (2022-09-28)

    • Fix a security issue on filesystem loader (possibility to load a template outside a configured directory)

    3.4.2 (2022-08-12)

    • Allow inherited magic method to still run with calling class
    • Fix CallExpression::reflectCallable() throwing TypeError
    • Fix typo in naming (currency_code)

    3.4.1 (2022-05-17)

    • Fix optimizing non-public named closures

    3.4.0 (2022-05-22)

    • Add support for named closures

    3.3.10 (2022-04-06)

    • Enable bytecode invalidation when auto_reload is enabled

    3.3.9 (2022-03-25)

    • Fix custom escapers when using multiple Twig environments
    • Add support for "constant('class', object)"
    • Do not reuse internally generated variable names during parsing
    Commits
    • c38fd6b Prepare the 3.4.3 release
    • 5a858ac Merge branch '2.x' into 3.x
    • ab40267 Prepare the 2.15.3 release
    • fc18c2e Update CHANGELOG
    • 2e8acd9 Merge branch '2.x' into 3.x
    • d6ea14a Merge branch '1.x' into 2.x
    • 35f3035 security #cve- Fix a security issue on filesystem loader (possibility to load...
    • be33323 Merge branch '2.x' into 3.x
    • 9170edf Fix doc CS
    • fab3e0f minor #3744 Adding installation instructions for Symfony (ThomasLandauer)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(v1.3.1)
Owner
Gigadrive UG
Software Development company based in Germany
Gigadrive UG
Easily add routes to your Laravel app by creating Markdown or Blade files

Laravel Pages This package lets you create pages using Markdown or Blade without having to worry about creating routes or controllers yourself. Essent

ARCHTECH 104 Nov 12, 2022
Highly-extensible PHP Markdown parser which fully supports the CommonMark and GFM specs.

league/commonmark league/commonmark is a highly-extensible PHP Markdown parser created by Colin O'Dell which supports the full CommonMark spec and Git

The League of Extraordinary Packages 2.4k Dec 29, 2022
A highly configurable markdown renderer and Blade component for Laravel

A highly configurable markdown renderer and Blade component for Laravel This package contains: a Blade component that can render markdown a highly con

Spatie 230 Jan 7, 2023
Generate pseudo-static pages from markdown and HTML files for Flarum

Flarum Pages Generator This is not a Flarum extension. This package provides a Flarum extender that you can use in the local extend.php to define cust

Clark Winkelmann 7 Feb 21, 2022
A super lightweight Markdown parser for PHP projects and applications.

A speedy Markdown parser for PHP applications. This is a super lightweight Markdown parser for PHP projects and applications. It has a rather verbose

Ryan Chandler 15 Nov 8, 2022
Better Markdown Parser in PHP

Parsedown Better Markdown Parser in PHP - Demo. Features One File No Dependencies Super Fast Extensible GitHub flavored Tested in 5.3 to 7.3 Markdown

Emanuil Rusev 14.3k Dec 28, 2022
Convert HTML to Markdown with PHP

HTML To Markdown for PHP Library which converts HTML to Markdown for your sanity and convenience. Requires: PHP 7.2+ Lead Developer: @colinodell Origi

The League of Extraordinary Packages 1.5k Jan 3, 2023
A PHP tool to generate templateable markdown documentation from the docblocks or type-hints of your codebase.

Roster Installation To install, simply require the package using composer: composer require

Jordan LeDoux 14 Sep 25, 2022
Render colored Markdown contents on console terminal

cli-markdown Render colored markdown contents on console terminal Preview run demo by php example/demo.php Features support auto render color on termi

PHPComLab 6 Sep 29, 2022
PHP Markdown Engine Support

PHP Markdown Version v1.x support all PHP version >=5.4 v2.x support all PHP version >=7.0 Cài đặt thư viện Thư viện này được cài đặt thông qua Compos

Hung Nguyen 3 Jul 1, 2022
markdown wiki/blog

Kwiki markdown wiki/blog Usage Place your markdown files in the /wiki directory. Categories are directories and subcategories are subdirectories. If y

Ryan Winchester 76 Dec 30, 2022
Rendering markdown from PHP code

JBZoo / Markdown Installing composer require jbzoo/markdown Usage Rendering Table <?php declare(strict_types=1); use JBZoo\Markdown\Table; echo (new

JBZoo Toolbox 1 Dec 26, 2021
Gruik ! An open-source markdown note-taking web app. [ABANDONED PROJECT]

What is Gruik ? It's a free & open-source note-taking service. A space where you can store notes, tutorials, code snippets... by writing them in markd

Adrien Pétremann 329 Dec 14, 2022
PHP Markdown & Extra

PHP Markdown & Extra An updated and stripped version of the original PHP Markdown by Michel Fortin. Works quite well with PSR-0 autoloaders and is Com

dflydev 173 Dec 30, 2022
A simple regex-based Markdown parser in PHP

Slimdown A simple regex-based Markdown parser in PHP. Supports the following elements (and can be extended via Slimdown::add_rule()): Headers Links Bo

Aband*nthecar 16 Dec 24, 2022
Docbook Tool for static documentation generation from Markdown files

Roave Docbook Tool Static HTML and PDF generator tool for generating documentation from Markdown files. Generates a deployable HTML file from Markdown

Roave, LLC 40 Dec 14, 2022
PHP based Markdown documentation viewer

PHP based viewer for Markdown files, to view them with fenced code highlighting and navigation.

null 5 Dec 9, 2022
Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.

PHP Markdown PHP Markdown Lib 1.9.0 - 1 Dec 2019 by Michel Fortin https://michelf.ca/ based on Markdown by John Gruber https://daringfireball.net/ Int

Michel Fortin 3.3k Jan 1, 2023
Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.

PHP Markdown PHP Markdown Lib 1.9.0 - 1 Dec 2019 by Michel Fortin https://michelf.ca/ based on Markdown by John Gruber https://daringfireball.net/ Int

Michel Fortin 3.3k Jan 1, 2023
It's basically a dynamic web browser extension that can display notifications with the help of an admin-controlled dynamic API.

D-NOTIFIER A self controlled dynamic API based web browser extension built by Sahil Kumar How It Works? It's basically a dynamic web browser extension

Sahil Kumar 1 Jan 6, 2022