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


PHP Markdown::convertToHtml方法代码示例

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


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

示例1: getReadme

 public static function getReadme($owner, $repo)
 {
     $token = self::getAccessToken();
     $readmeUrl = 'https://api.github.com/repos/' . $owner . '/' . $repo . '/readme?access_token=' . $token;
     $client = self::getClient();
     $res = $client->get($readmeUrl, []);
     $readmeHash = json_decode($res->getBody(), true);
     $readme = ['readme' => \Markdown::convertToHtml(imap_base64($readmeHash['content']))];
     return $readme;
 }
开发者ID:briscula,项目名称:astral,代码行数:10,代码来源:GithubClient.php

示例2: function

<?php

Route::post('/markdown/preview', function () {
    return Markdown::convertToHtml(Request::get('content'));
});
开发者ID:larabox,项目名称:soa_addon,代码行数:5,代码来源:routes.php

示例3: docsData

 public static function docsData($input)
 {
     if (!empty($input["data"]["errors"])) {
         $input["data"]["errors"] = array();
     }
     $docs_path = base_path('resources/docs/');
     try {
         $file = file_get_contents($docs_path . $input["docs"] . ".md", true);
     } catch (\ErrorException $e) {
         $file = "";
         array_push($input["data"]["errors"], "File is most likely missing!");
     }
     $input["data"]["data"] = \Markdown::convertToHtml($file);
     return $input;
 }
开发者ID:jacksonwebservices,项目名称:laravel-display,代码行数:15,代码来源:Display.php

示例4: postEdit

 public function postEdit($group)
 {
     if (!in_array($group, $this->manager->config(Manager::EXCLUDE_GROUPS_KEY))) {
         $name = \Request::get('name');
         $value = \Request::get('value');
         list($locale, $key) = explode('|', $name, 2);
         if ($this->isLocaleEnabled($locale)) {
             $translation = $this->manager->firstOrNewTranslation(array('locale' => $locale, 'group' => $group, 'key' => $key));
             $markdownSuffix = $this->manager->config(Manager::MARKDOWN_KEY_SUFFIX);
             $isMarkdownKey = $markdownSuffix != '' && ends_with($key, $markdownSuffix) && $key !== $markdownSuffix;
             if (!$isMarkdownKey) {
                 // strip off trailing spaces and eol's and &nbsps; that seem to be added when multiple spaces are entered in the x-editable textarea
                 $value = trim(str_replace(" ", ' ', $value));
             }
             $value = $value !== '' ? $value : null;
             $translation->value = $value;
             $translation->status = $translation->isDirty() && $value != $translation->saved_value ? Translation::STATUS_CHANGED : Translation::STATUS_SAVED;
             $translation->save();
             if ($isMarkdownKey) {
                 $markdownKey = $key;
                 $markdownValue = $value;
                 $key = substr($markdownKey, 0, -strlen($markdownSuffix));
                 $translation = $this->manager->firstOrNewTranslation(array('locale' => $locale, 'group' => $group, 'key' => $key));
                 $value = $markdownValue !== null ? \Markdown::convertToHtml(str_replace(" ", ' ', $markdownValue)) : null;
                 $translation->value = $value;
                 $translation->status = $translation->isDirty() && $value != $translation->saved_value ? Translation::STATUS_CHANGED : Translation::STATUS_SAVED;
                 $translation->save();
             }
         }
     }
     return array('status' => 'ok');
 }
开发者ID:vsch,项目名称:laravel-translation-manager,代码行数:32,代码来源:Controller.php


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