当前位置: 首页>>代码示例>>PHP>>正文


PHP ParsedownExtra::setBreaksEnabled方法代码示例

本文整理汇总了PHP中ParsedownExtra::setBreaksEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP ParsedownExtra::setBreaksEnabled方法的具体用法?PHP ParsedownExtra::setBreaksEnabled怎么用?PHP ParsedownExtra::setBreaksEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParsedownExtra的用法示例。


在下文中一共展示了ParsedownExtra::setBreaksEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse

 /**
  * Parse a given path to the documentation for a file. Performs a case 
  * insensitive lookup on the file system. Automatically appends the file 
  * extension to one of the markdown extensions as well so /install/ in a
  * web browser will match /install.md or /INSTALL.md.
  * 
  * Filepath: /var/www/myproject/src/cms/en/folder/subfolder/page.md
  * URL: http://myhost/mywebroot/dev/docs/2.4/cms/en/folder/subfolder/page
  * Webroot: http://myhost/mywebroot/
  * Baselink: dev/docs/2.4/cms/en/
  * Pathparts: folder/subfolder/page
  * 
  * @param DocumentationPage $page
  * @param String $baselink Link relative to webroot, up until the "root" 
  *							of the module. Necessary to rewrite relative 
  *							links
  *
  * @return String
  */
 public static function parse(DocumentationPage $page, $baselink = null)
 {
     if (!$page || !$page instanceof DocumentationPage) {
         return false;
     }
     $md = $page->getMarkdown(true);
     // Pre-processing
     $md = self::rewrite_image_links($md, $page);
     $md = self::rewrite_relative_links($md, $page, $baselink);
     $md = self::rewrite_api_links($md, $page);
     $md = self::rewrite_heading_anchors($md, $page);
     $md = self::rewrite_code_blocks($md);
     $parser = new ParsedownExtra();
     $parser->setBreaksEnabled(false);
     $text = $parser->text($md);
     return $text;
 }
开发者ID:Jellygnite,项目名称:silverstripe-docsviewer,代码行数:36,代码来源:DocumentationParser.php

示例2: markdown

 /**
  * markdown  
  * 
  * @param mixed $text 
  * @access public
  * @return void
  */
 public function markdown($text)
 {
     $html = $this->pluginHandle(__CLASS__)->trigger($parsed)->markdown($text);
     if (!$parsed) {
         static $parser;
         if (empty($parser)) {
             $parser = new ParsedownExtra();
             $parser->setBreaksEnabled(true);
         }
         $html = $parser->text($text);
     }
     return $html;
 }
开发者ID:BlueBreeze,项目名称:typecho,代码行数:20,代码来源:Comments.php

示例3: ParsedownExtra

 * Copyright (c) 2016 AvikB, some rights reserved.
 *  Copyright under Creative Commons Attribution-ShareAlike 3.0 Unported,
 *  for details visit: https://creativecommons.org/licenses/by-sa/3.0/
 *  
 * @Contributors:
 * Created by AvikB for noncommercial MusicBee project.
 *  Spelling mistakes and fixes from community members.
 *
 */
require_once $_SERVER['DOCUMENT_ROOT'] . '/functions.php';
include_once $link['root'] . 'includes/parsedown/Parsedown.php';
include_once $link['root'] . 'includes/parsedown/ParsedownExtra.php';
$data = Format::parsePage($link['url'] . 'pages/credit/credit.md');
//load parsedown for markdown to html converter
$ParsedownExtra = new ParsedownExtra();
$ParsedownExtra->setBreaksEnabled(true);
$data['html_raw'] = $ParsedownExtra->text($data['markdown']);
//load and use html purifier for unsafe html.
$data['html_safe'] = Format::htmlSafeOutput($data['html_raw']);
//purify the readme note html
?>
<!DOCTYPE html>
<html>
<head>
	<title><?php 
echo $data['title'];
?>
</title>
	<meta name="description" content="<?php 
echo $data['description'];
?>
开发者ID:Avik-B,项目名称:musicbee-website,代码行数:31,代码来源:credit.template.php

示例4: markdown

 /**
  * A very simple markdown parser.
  *
  * @since 150113 First documented version.
  *
  * @param string $string Input string to convert.
  * @param array  $args   Any additional behavioral args.
  *
  * @return string Markdown converted to HTML markup.
  */
 public function markdown($string, array $args = [])
 {
     if (!($string = trim((string) $string))) {
         return $string;
         // Not possible.
     }
     $default_args = ['oembed' => false, 'breaks' => true, 'no_p' => false];
     $args = array_merge($default_args, $args);
     $args = array_intersect_key($args, $default_args);
     $oembed = (bool) $args['oembed'];
     $breaks = (bool) $args['breaks'];
     $no_p = (bool) $args['no_p'];
     if ($oembed && strpos($string, '://') !== false) {
         $_spcsm = $this->spcsmTokens($string, [], __FUNCTION__);
         $_oembed_args = array_merge(wp_embed_defaults(), ['discover' => false]);
         $_spcsm['string'] = preg_replace_callback('/^\\s*(https?:\\/\\/[^\\s"]+)\\s*$/im', function ($m) use($_oembed_args) {
             $oembed = wp_oembed_get($m[1], $_oembed_args);
             return $oembed ? $oembed : $m[0];
         }, $_spcsm['string']);
         $string = $this->spcsmRestore($_spcsm);
         unset($_spcsm, $_oembed_args);
         // Housekeeping.
     }
     if (is_null($parsedown =& $this->cacheKey(__FUNCTION__, 'parsedown'))) {
         $parsedown = new \ParsedownExtra();
         // Singleton.
     }
     $parsedown->setBreaksEnabled($breaks);
     $html = $parsedown->text($string);
     if ($no_p) {
         // Remove `<p></p>` wrap?
         $html = preg_replace('/^\\<p\\>/i', '', $html);
         $html = preg_replace('/\\<\\/p\\>$/i', '', $html);
     }
     return $html;
     // Gotta love Parsedown :-)
 }
开发者ID:websharks,项目名称:comment-mail,代码行数:47,代码来源:UtilsString.php

示例5: dateHMDMY

    }
    // fin while
    echo '
							</ul>
							';
} else {
    $displayDate = "";
    // initialiser
    if ($donnees['edited']) {
        $displayDate = "<sup>édité</sup> ";
    }
    $displayDate .= dateHMDMY($donnees["date"]);
    echo '
							<a href="/news/" class="btn btn-primary btn-sm"><i class="ionicons ion-arrow-left-c">&nbsp;</i> Revenir à la liste</a>
							<div class="news">
								<span class="date">' . $displayDate . '</span>
								<h1>' . $donnees["titre"] . '</h1>
								<div class="art">' . $md->setBreaksEnabled(true)->text($donnees["article"]) . '</div>
							</div>
								';
}
?>

						</div>
					</div>

				</div> <!-- //.bs-component -->
			</div> <!-- //.col-lg-9 -->

<?php 
require '../includes/footer.php';
开发者ID:Asandolo,项目名称:website,代码行数:31,代码来源:index.php

示例6: __construct

 private function __construct()
 {
     $this->parser = new ParsedownExtra();
     $this->parser->setBreaksEnabled(true);
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:5,代码来源:markdown.php


注:本文中的ParsedownExtra::setBreaksEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。