Content in Pagenode is represented by Nodes. Each Node is a file with a .md
extension, some Markdown content and an optional header.
E.g. nodes/adding-content.md
title: Content
date: 2018.10.30 22:10
tags: documentation, guide
---
## Adding Content
Content in Pagenode is represented by _Nodes_. Each Node is a
file with a `.md` extensions which has some Markdown content and
an optional header.
The header and content sections are divided by ---
(3 dashes) on its own line. The header section is optional, but it is recommended to always supply one.
The header is a simple list of keys and values separated by newlines. Keys and values are separated by :
. Keys are single words (no whitespace). Values can be anything but a line break.
You can add any keys and values you like in the header. All keys and values are directly accessible from the Node instances returned by select()
. E.g. the title
key in the example above can be accessed through $node->title
.
Note that there are three keys that are treated specially:
A date and time value in yyyy.mm.dd h:i
or yyyy.mm.dd
format. By default all nodes are sorted by this date. If no date is given in the header, the file modification date is used.
The timezone of these dates is either set by the PN_TIMEZONE
constant, the default_timezone
from your php.ini, or if both are empty, UTC
.
A comma separated list of tags. This list is split into an array by Pagenode. Nodes are easily filterable by tags.
If set to false
the Node will not be selectable. The default is true
.
Pagenode uses the excellent Parsedown for transforming Github flavored Markdown.
In addition, Pagenode comes with a simple, versatile syntax highlighting extension. Syntax highlighting is enabled by default for the php
, js
, sql
, and c
languages. The language is determined by the language name of the code bracket:
```js
var someJS = true;
```
You can use the following CSS to style the syntax highlighted text:
code span.comment { color: #666; }
code span.string { color: #6a0; }
code span.regexp { color: #719; }
code span.punct { color: #17b; }
code span.keyword { color: #f0b; }
code span.number { color: #d83; }
code span.var { color: #209; }
code span.def { color: #923; }
If you want to disable Pagenode's syntax highlighting in favor of another library, set the list of languages to highlight to null
or an empty string before including the pagenode.php
:
define('PN_SYNTAX_HIGHLIGHT_LANGS', null);
require_once('pagenode.php');
// ...
Up Next: Selecting Content »