Download the PHP package roelmagdaleno/markdown-to-notion-blocks without Composer

On this page you can find all versions of the php package roelmagdaleno/markdown-to-notion-blocks. 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 markdown-to-notion-blocks

Markdown to Notion Blocks

This package allows you to convert markdown to Notion blocks in JSON or Array format.

The generated Notion blocks, in JSON format, are intended to be sent to the Notion API to create a new page or update an existing one.

It's using thephpleague/commonmark under the hood to parse the Markdown.

Installation

You can install the package via composer:

Size Limits

Maximum Blocks

The Notion API only accepts a maximum of 100 blocks per request. So, this package will always return an array, in chunks, of 100 blocks.

You'll have to send each chunk to the Notion API separately.

Text Content

The Notion API only accepts a maximum of 2000 characters per text content. If the text content is more than 2000 characters, the package will split them into multiple rich text objects.

Rich Text

The Notion API only accepts a maximum of 100 rich text objects per block. If the rich text objects are more than 100, the package will split them into multiple blocks.

Usage

This package provides a MarkdownToNotionBlocks class that you can use to convert markdown to Notion blocks in JSON or Array format.

Array

The MarkdownToNotionBlocks::array static method will return the Notion blocks in array format.

The code above will output the following array:

JSON

The MarkdownToNotionBlocks::json static method will return the Notion blocks in JSON format.

[!NOTE] Since the Notion blocks are returned in chunks of 100, the JSON output might not be valid for the Notion API. The JSON output is useful for debugging purposes or send it from the server to the client.

The code above will output the following JSON:

Transform Output

If you want to transform the output before sending to the Notion API, you can use the MarkdownToNotionBlocks::array method to get the Notion blocks in array format and then apply your transformations.

For example, by default each Notion block has a color property set to default. If you want to change the color of the heading to red, you can do the following:

After applying the transformation, encode the array to JSON and send it to the Notion API.

Supported Notion Blocks

The following Notion blocks are supported by this package:

Each block support rich text properties like bold, italic, strikethrough, underline, and inline code.

Example

The following example shows how to convert a Markdown string to Notion blocks in Array format.

Testing


All versions of markdown-to-notion-blocks with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
league/commonmark Version ^2.5
incenteev/emoji-pattern Version ^1.3
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 roelmagdaleno/markdown-to-notion-blocks contains the following files

Loading the files please wait ....