Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Robert Miles | acabef963e |
23
README.md
23
README.md
|
@ -1,30 +1,37 @@
|
||||||
# tildewiki
|
# khcms-md
|
||||||
|
|
||||||
this is a small collection of parsedown extensions used across several tildeverse
|
this is a fork of [tildewiki](https://tildegit.org/ben/tildewiki) made for
|
||||||
sites to power the wiki.
|
[khcms](https://tildegit.org/khuxkm/khcms). specifically, it removes the
|
||||||
|
font awesome/fork awesome dependency by removing the automated header links
|
||||||
|
(which, while awesome for a wiki, doesn't translate as well to website pages).
|
||||||
|
|
||||||
|
credit to ben for the code (since he wrote it and I just removed some lines).
|
||||||
|
|
||||||
## basic usage
|
## basic usage
|
||||||
|
|
||||||
1. add tildewiki as a vcs repository in composer.json
|
you should just be able to use khcms. however, if you want to use this
|
||||||
|
outside of the khcms project, you can follow these instructions:
|
||||||
|
|
||||||
|
1. add khcms-md as a vcs repository in composer.json
|
||||||
```json
|
```json
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://tildegit.org/ben/tildewiki"
|
"url": "https://tildegit.org/khuxkm/khcms-md"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
1. require tildeverse/wiki in composer.json
|
1. require khuxkm/khcms-md in composer.json
|
||||||
```json
|
```json
|
||||||
"require": {
|
"require": {
|
||||||
"tildeverse/wiki": "dev-master"
|
"khuxkm/khcms-md": "dev-master"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. get an instance
|
1. get an instance
|
||||||
```php
|
```php
|
||||||
$parser = Tildeverse\Wiki\Parser::factory();
|
$parser = Khuxkm\KHCMSMD\Parser::factory();
|
||||||
```
|
```
|
||||||
|
|
||||||
1. parse stuff
|
1. parse stuff
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
{
|
{
|
||||||
"name": "tildeverse/wiki",
|
"name": "khuxkm/khcms-md",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "parsedown extensions for tilde wikis",
|
"description": "parsedown extensions for khcms-esque sites",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"require": {
|
"require": {
|
||||||
"erusev/parsedown-extra": "^0.7.1",
|
"erusev/parsedown-extra": "^0.7.1",
|
||||||
"mnapoli/front-yaml": "^1.6"
|
"mnapoli/front-yaml": "^1.6"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {"Tildeverse\\Wiki\\": "src/"}
|
"psr-4": {"Khuxkm\\KHCMSMD\\": "src/"}
|
||||||
},
|
},
|
||||||
"license": "GPLv3",
|
"license": "GPLv3",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Robert Miles",
|
||||||
|
"email": "khuxkm@tilde.team"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Ben Harris",
|
"name": "Ben Harris",
|
||||||
"email": "ben@tilde.team"
|
"email": "ben@tilde.team"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Tildeverse\Wiki;
|
namespace Khuxkm\KHCMSMD;
|
||||||
|
|
||||||
use Mni\FrontYAML;
|
use Mni\FrontYAML;
|
||||||
|
|
||||||
class Parser implements FrontYAML\Markdown\MarkdownParser {
|
class Parser implements FrontYAML\Markdown\MarkdownParser {
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->mdparser = new WikiParsedown();
|
$this->mdparser = new SiteParsedown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parse($markdown) {
|
public function parse($markdown) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Tildeverse\Wiki;
|
namespace Khuxkm\KHCMSMD;
|
||||||
|
|
||||||
class WikiParsedown extends \ParsedownExtra {
|
class SiteParsedown extends \ParsedownExtra {
|
||||||
protected function blockHeader($line) {
|
protected function blockHeader($line) {
|
||||||
$header = parent::blockHeader($line);
|
$header = parent::blockHeader($line);
|
||||||
|
|
||||||
|
@ -12,10 +12,6 @@ class WikiParsedown extends \ParsedownExtra {
|
||||||
$id = preg_replace('/[^a-z0-9]/', '-', strtolower($header['element']['text']));
|
$id = preg_replace('/[^a-z0-9]/', '-', strtolower($header['element']['text']));
|
||||||
$header['element']['attributes']['id'] = $id;
|
$header['element']['attributes']['id'] = $id;
|
||||||
|
|
||||||
$header['element']['text'] =
|
|
||||||
'<small><a class="text-muted" href="#' . $id . '"><i class="fa fa-link"></i></a></small> '
|
|
||||||
. $header['element']['text'];
|
|
||||||
|
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue