Replace homemade table of content generator with existing jQuery plugin. Now toc is linked to document headings.

This commit is contained in:
Andrew Manning
2016-06-30 21:50:38 -04:00
parent 81da9f99e4
commit 7124c0aee5
3 changed files with 6 additions and 5 deletions

View File

@@ -126,8 +126,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$content = ($p['content'] !== '' ? $p['content'] : '"# New page\n"');
// Render the Markdown-formatted page content in HTML
require_once('library/markdown.php');
$toc_content = wiki_generate_toc(json_decode($content));
$html = purify_html(Markdown($toc_content));
$html = wiki_generate_toc(purify_html(Markdown(json_decode($content))));
$renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName);
$hide_editor = false;
$showPageControls = $wiki_editor;
@@ -200,8 +199,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$content = $_POST['content'];
$resource_id = $_POST['resource_id'];
require_once('library/markdown.php');
$content = wiki_generate_toc($content);
$html = purify_html(Markdown($content));
$html = wiki_generate_toc(purify_html(Markdown($content)));
$w = wiki_get_wiki($resource_id);
$wikiURL = argv(0).'/'.argv(1).'/'.$w['urlName'];
$html = wiki_convert_links($html,$wikiURL);