hollodotme/treemdown

一个用于浏览带有HTML渲染、语法高亮和搜索功能的Markdown文件的PHP类

v2.0.0-rc1 2019-09-10 07:53 UTC

README

Build Status Coverage Status Latest Stable Version Total Downloads License

TreeMDown [triː <'em> daʊn]

... 是一个单页PHP应用程序,用于在文件结构中浏览Markdown文档并将它们转换为HTML。

一个功能齐全的演示可以在以下链接找到!

treemdown

新闻

你喜欢TreeMDown,并且对浏览多个Markdown文件树感兴趣吗?

查看 TreeMDown-Multi实时演示在此处。

最新更新

  • 更新到 highlightjs 版本 8.3
  • 修复了Markdown代码的语法高亮问题
  • 处理同一树中的Markdown文件之间的内部链接(请参阅文档)

需求/依赖

  • PHP >= 5.3
  • Parsedown-Extra 通过composer
  • Web服务器(Apache、nginx等)

注意: 此应用程序目前仅在Linux系统上进行了测试。

安装

通过composer

要获取最新稳定版本,请检查 Packagist 上的版本,并将其添加到您的 composer.json

{
	"require": {
		"hollodotme/treemdown": "~1.0"
	}
}

要获取最新版本,请将以下内容添加到您的 composer.json

{
	"repositories": [
		{
			"type": "vcs",
			"url": "git@github.com:hollodotme/TreeMDown.git"
		}
	],

	"require": {
		"hollodotme/treemdown": "dev-master"
	}
}

现在包含 vendor/autoload.php 并开始使用。

用法

基本

<?php

use hollodotme\TreeMDown\TreeMDown;

$treemdown = new TreeMDown('/path/to/your/markdown/files');

$treemdown->display();

带有定制和选项

<?php

use hollodotme\TreeMDown\TreeMDown;

// Create instance
$treemdown = new TreeMDown( '/path/to/your/markdown/files' );

# [Page meta data]
#
# Set a projectname
$treemdown->setProjectName('Your project name');

# Set a short description
$treemdown->setShortDescription('Your short description');

# Set a company name
$treemdown->setCompanyName('Your company name');

# [Output options]
#
# Show or hide empty folders in tree
#
# Default: Empty folders will be displayed
#
#$treemdown->showEmptyFolders();
$treemdown->hideEmptyFolders();

# Set the default file that is shown if no file or path is selected (initial state)
# The file path must be __relative__ to the root directory above: '/path/to/your/markdown/files'
#
# Default: index.md
#
$treemdown->setDefaultFile('README.md');

# Show/Hide filename suffix
#
# Default: Suffix is shown
#
#$tmd->showFilenameSuffix();
$tmd->hideFilenameSuffix();

# Prettify directory and file names
# This removes all "-" and "_" from the names displayed in the tree
#
# Default: Pretty names are disabled
#
#$tmd->disablePrettyNames();
$tmd->enablePrettyNames();

# [File system options]
#
# Set the patterns for files you want to include
#
# Default: array( '*.md', '*.markdown')
#
$treemdown->setIncludePatterns( array( '*.md', '*.markdown') );

# Set the patterns for files/path you want to exclude
#
# Default: array( '.*' )
#
$treemdown->setExcludePatterns( array( '.*' ) );

$treemdown->display();

贡献

此应用程序使用以下库