diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-29 17:06:45 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-29 17:06:45 -0400 |
commit | 3e6af5c87692b5dbefd59d7b2350670d4e1cb3a4 (patch) | |
tree | 62ea2191cfe5ff4aeed55211a82dae3de0859eac | |
parent | 75b169f391d7d6a5c140e74603e87897b39e8344 (diff) | |
download | volse-hubzilla-3e6af5c87692b5dbefd59d7b2350670d4e1cb3a4.tar.gz volse-hubzilla-3e6af5c87692b5dbefd59d7b2350670d4e1cb3a4.tar.bz2 volse-hubzilla-3e6af5c87692b5dbefd59d7b2350670d4e1cb3a4.zip |
Hacked Parsedown and Markdown to add class inline-code to <code> blocks for proper inline code rendering. Stopped using Parsedown even though Markdown is slower, hence extra delay when previewing pages.
-rw-r--r-- | Zotlabs/Module/Wiki.php | 14 | ||||
-rw-r--r-- | library/markdown.php | 2 | ||||
-rw-r--r-- | library/parsedown/Parsedown.php | 3 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 9 | ||||
-rw-r--r-- | view/tpl/wiki.tpl | 6 |
5 files changed, 28 insertions, 6 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 51630bddc..efd4120ca 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -93,8 +93,10 @@ class Wiki extends \Zotlabs\Web\Controller { $hide_editor = false; $showPageControls = true; } - $parsedown = new Parsedown(); - $renderedContent = $parsedown->text(json_decode($content)); + //$parsedown = new Parsedown(); + //$renderedContent = $parsedown->text(json_decode($content)); + require_once('library/markdown.php'); + $renderedContent = Markdown(json_decode($content)); $o .= replace_macros(get_markup_template('wiki.tpl'),array( '$wikiheader' => $wikiheader, @@ -121,8 +123,10 @@ class Wiki extends \Zotlabs\Web\Controller { // Render mardown-formatted text in HTML if((argc() > 2) && (argv(2) === 'preview')) { $content = $_POST['content']; - $parsedown = new Parsedown(); - $html = $parsedown->text($content); + //$parsedown = new Parsedown(); + //$html = $parsedown->text($content); + require_once('library/markdown.php'); + $html = Markdown($content); json_return_and_die(array('html' => $html, 'success' => true)); } @@ -230,7 +234,7 @@ class Wiki extends \Zotlabs\Web\Controller { } $page = wiki_create_page($name . '.md', $resource_id); if ($page['success']) { - json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki'].'/'.$name, 'success' => true)); + json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki'].'/'.$name.'.md', 'success' => true)); } else { logger('Error creating page'); json_return_and_die(array('message' => 'Error creating page.', 'success' => false)); diff --git a/library/markdown.php b/library/markdown.php index f548fc26c..0e3275ff2 100644 --- a/library/markdown.php +++ b/library/markdown.php @@ -1136,7 +1136,7 @@ class Markdown_Parser { # Create a code span markup for $code. Called from handleSpanToken. # $code = htmlspecialchars(trim($code), ENT_NOQUOTES); - return $this->hashPart("<code>$code</code>"); + return $this->hashPart("<code class=\"inline-code\">$code</code>"); } diff --git a/library/parsedown/Parsedown.php b/library/parsedown/Parsedown.php index 5edd44843..7b920d730 100644 --- a/library/parsedown/Parsedown.php +++ b/library/parsedown/Parsedown.php @@ -1074,6 +1074,9 @@ class Parsedown 'element' => array( 'name' => 'code', 'text' => $text, + 'attributes' => array( + 'class' => 'inline-code' + ), ), ); } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 1c2e8cdb2..ae712e3d4 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -120,6 +120,15 @@ code { color: #000; } +.inline-code { + font-size: 1em; + padding: 0; + border: 0; + background: #FFF; + display: inline; + color: #000; +} + pre { background: #F5F5F5; color: #333; diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index e931cd6e6..a6f274bfb 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -4,6 +4,12 @@ width: 100%; height: 500px; } + .fade.in { + -webkit-transition: opacity 2s 1s ease; + -moz-transition: opacity 2s 1s ease; + -o-transition: opacity 2s 1s ease; + transition: opacity 2s 1s ease; + } </style> <div class="generic-content-wrapper"> <div class="section-title-wrapper"> |