mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-21 16:13:00 +00:00
oneboxing: change to use [[[triple square brackets]]]
This is because for some reason when extending Parsedown to add a new block type for [[internal links]] to detect oneboxing means that it's impossible to tell if we're inside e.g. a bulleted list or not :-/
This commit is contained in:
parent
dd60208d4f
commit
bf2d797d92
2 changed files with 14 additions and 5 deletions
|
@ -8,7 +8,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
- Added support for embedding external YouTube and Vimeo videos (e.g. `![alt text](https://youtube.com/watch?v=pID0xQ2qnrQ)`)
|
||||
- If you know of a cool service that should be supported, please open an issue - YouTube and Vimeo were just the only 2 I could think of
|
||||
- Known issue: specifying the size (i.e. with ` | 500x400` inside the brackets `()` there) doesn't currently work because iframes are weird
|
||||
- Added [oneboxing](https://meta.discourse.org/t/rich-link-previews-with-onebox/98088): rich previews for internal links. If an internal link is on it's own with nothing before or after it on a line, then it'll be turned into a onebox
|
||||
- Added [oneboxing](https://meta.discourse.org/t/rich-link-previews-with-onebox/98088): rich previews for internal links. If an internal link with 3 square brackets (e.g. `[[[example]]]`) is on it's own with nothing before or after it on a line, then it'll be turned into a onebox
|
||||
- 2 new settings have also been added to control it: `parser_onebox_enabled` and `parser_onebox_preview_length`
|
||||
- TODO: Update the dynamic help page for this.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
register_module([
|
||||
"name" => "Parsedown",
|
||||
"version" => "0.12",
|
||||
"version" => "0.12.1",
|
||||
"author" => "Emanuil Rusev & Starbeamrainbowlabs",
|
||||
"description" => "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https://github.com/erusev/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
|
||||
"extra_data" => [
|
||||
|
@ -1573,12 +1573,21 @@ class PeppermintParsedown extends ParsedownExtra
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
protected function blockOneBox($fragment) {
|
||||
/*
|
||||
* ██████ ███ ██ ███████ ██████ ██████ ██ ██ ██ ███ ██ ██████
|
||||
* ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██
|
||||
* ██ ██ ██ ██ ██ █████ ██████ ██ ██ ███ ██ ██ ██ ██ ██ ███
|
||||
* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
* ██████ ██ ████ ███████ ██████ ██████ ██ ██ ██ ██ ████ ██████
|
||||
*/
|
||||
protected function blockOneBox($fragment, $current_block) {
|
||||
global $env, $settings, $pageindex;
|
||||
error_log("FRAGMENT ".var_export($fragment, true));
|
||||
error_log("CBLOCK ".var_export($current_block, true));
|
||||
error_log("***********");
|
||||
|
||||
if($fragment["indent"] > 0 || !$settings->parser_onebox_enabled) return;
|
||||
if(preg_match('/^\[\[([^\]]*?)\]\]$/u', $fragment["text"], $matches) !== 1)
|
||||
if(preg_match('/^\[\[\[([^\]]*?)\]\]\]$/u', $fragment["text"], $matches) !== 1)
|
||||
return;
|
||||
|
||||
// 1: Parse parameters out
|
||||
|
|
Loading…
Reference in a new issue