Download the PHP package sinnbeck/markdom without Composer

On this page you can find all versions of the php package sinnbeck/markdom. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package markdom

Latest Version on Packagist Downloads on Packagist tests

Introduction

Markdom is a laravel package to make it simple to convert markdown to beautifully rendered html. It adds classes and allows you to automatically do code highlighting.

Installation

Install the package using composer

After that is a good idea to add the facade to your config/app.php aliases array.

Publish the config

To publish the config file simply run the following to add markdom.php to your config directory.

Usage

Markdom comes with a blade helper to easily convert markdown to html

You can also call it though the facade

Configuration

The main feature of Markdom is to add classes to your rendered html. This requires you to set up a class map in markdom.php. This determines which elements are getting what classes. Here is a quick example using TailwindCss syntax.

The key can be any css selector, meaning you can also do ul > li > ul or even .classname. The classes are parsed in the order that they are listed in the config, meaning you can add additional classes to those set before.

The above will add the class title to the header elements, and the then 'font-bold border-b' to each. \ Result:

Adding id and href

Markdom makes it simple to add id and links (<a href />) to headings (for use in documentation). Just set the links.enabled to true in the markdom.php config file, and Markdom takes care of the rest.

Check the documentation if the config, for configuration options.

Markdown configuration

It is possible to tweak the parsing of markdown. Under the hood, Mardom uses league/commonmark, meaning all settings under the commonmark key, is just sent directly to CommonMark. See a list of available settings here: https://commonmark.thephpleague.com/2.3/configuration/#configuration

Markdown extensions

CommonMark comes with a lot of extensions. These can be added to the commonmark_extensions array which will make them automatically load. See a list of available extensions here: https://commonmark.thephpleague.com/2.3/extensions/overview/

Code highlighting

If you are using markdown for parsing code, you may enable the code highlighter, by setting MARKDOM_CODE_HIGHLIGHT=true in your .env file. This will automatically add highlight.js classes to the code found in code tags.

CommonMark will convert `somecode` and \ ``` \ somecode \ ``` \ to <code>somecode</code> and <pre><code>somecode</code></pre> which will be passed to scrivo/highlight.php (a php implementation of highlight.js).

Highlight theme and css

It is possible to have your code styled automatically. This can be done simply by adding the @markdomStyles() directive to your page. This will embed the highlight.js css into your page. You can pass the name of a theme to the method, to get a specific stylesheet @markdomStyles('purebasic')

Highlighting theme

Highlight.js supports 91 themes currently. You can get an array of these themes by using Markdom::getAvailableThemes(). This can be useful for rendering a select, if the user is allowed to select theme.

Examples

Controller (markdown can be also be loaded from database or a file)

$this->foo = 'bar'; \ index.blade.php

Livewire

Markdom also works great with Livewire and does not require any javascript.

You can get a working example of an autoupdating markdown editor using livewire here: https://github.com/sinnbeck/markdom-livewire

Update notice!

If you are upgrading from version 1.x to 2.x, be aware that the config format has changed alot due to changes in commonmark! It is therefor a good idea to check the new example config file in the /config directory.

Testing

Run tests with

Todo

Credits


All versions of markdom with dependencies

PHP Build Version
Package Version
Requires league/commonmark Version ^2.0
scrivo/highlight.php Version ^9.18.1.3
wa72/htmlpagedom Version ^3.0
ext-dom Version *
gajus/dindent Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sinnbeck/markdom contains the following files

Loading the files please wait ....