public function getContent() { $doc = Parser::parse(file_get_contents($this->url)); $parser = new GithubMarkdown(); $parser->enableNewLines = true; return $parser->parse($doc->getContent()); }
public function getDbPrepValue() { $parser = new GithubMarkdown(); $parser->enableNewlines = true; $parser->html5 = true; return (string) $parser->parse($this->value); }
public function parseMarkdown($content) { $parser = new GithubMarkdown(); $parser->enableNewlines = true; return $parser->parse($content); // Parser markdown }
public function postProcess($post) { $parser = new GithubMarkdown(); $parser->html5 = true; $parser->enableNewlines = true; $parser->keepListStartNumber = true; return $parser->parse($post); }
/** * Get HTML mail part from ID * @param string $title * @param string $body * @paramn string $template_path * @return string $html */ public function getEmailHtml($title, $body, $template_path = null) { $template = $this->getHtmlTemplate($template_path); if ($this->titleInBody) { $body = "# " . $title . PHP_EOL . PHP_EOL . $body; } $parser = new GithubMarkdown(); $body = $parser->parse($body); $subject = html::specialEncode($title); $str = str_replace(array('{title}', '{content}'), array($subject, $body), $template); return $str; }
public function parse($text) { $text_wo_frontmatter = YII_DEBUG ? $text : $this->removeFrontmatter($text); $module = \jacmoe\mdpages\Module::getInstance(); $snippetParser = new SnippetParser(); $snippetParser->addSnippets($module->snippets); $text_snipped = $snippetParser->parse($text_wo_frontmatter); $markup = parent::parse($text_snipped); if ($module->generate_page_toc) { $markup = $this->applyToc($markup); } return $markup; }
echo Html::a($model->title, $model->getArticleUrl()); ?> <br/> <span class="hint-block small">Категория: <?php echo $model->category->title; ?> </span> </span> <?php echo Html::img(Yii::$app->request->baseUrl . $model->anons_img, ['class' => 'img-responsive article_anons_img']); ?> <div class="article_anons"> <?php $parser = new GithubMarkdown(); echo $parser->parse($model->anons); ?> </div> <div class="article_content"> <?php echo $parser->parse($model->post); ?> </div> <div class="article_config"> <i class="glyphicon glyphicon-calendar"></i> <?php echo Yii::$app->formatter->asDate($model->created_at); ?> | <i class="glyphicon glyphicon-user" title="Кто создал"></i> <?php echo Html::encode($model->author->username); ?>
/** * Humanizes github Readme.md file content * We adopt github retrieves Readme.md as json string where "content" field contains base64 encoded markdown * @param $data * @return string */ public static function humanizeReadme($data) { $readme = ''; $data = Json::decode($data); if (false === empty($data['content'])) { $content = base64_decode(str_replace('\\n', '', $data['content'])); $parser = new GithubMarkdown(); $readme = $parser->parse($content); } return $readme; }
public function youtubeDescriptionAsHtml() { $parser = new GithubMarkdown(); return $parser->parse(array_get($this->youtube_meta, 'description')); }
public function parse($text) { $markup = parent::parse($text); $markup = $this->applyToc($markup); return $markup; }
/** * {@inheritdoc} */ public function run($markdown = '') { return $this->markdown->parse($markdown); }
/** * Parse content using Markdown * @param string $content * @return string */ private function parse_markdown($content) { $parser = new GithubMarkdown(); $parser->enableNewlines = true; return $parser->parse($content); }
echo $form->field($model, 'username'); ?> <?php echo $form->field($model, 'email'); ?> <?php echo $form->field($model, 'email_repeat'); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?> <?php echo $form->field($model, 'password_repeat')->passwordInput(); ?> <div class="form-group"> <?php echo Html::submitButton('Зарегистрироватся', ['class' => 'btn btn-primary', 'name' => 'signup-button']); ?> </div> <?php ActiveForm::end(); ?> </div> </div> <?php Modal::begin(['id' => 'rulesModal', 'header' => '<h4 class="modal-title"><strong>Правила на сайте</strong></h4>']); $parser = new GithubMarkdown(); echo $parser->parse($rules->content); Modal::end();
public function handle() { $channelTitle = 'Realfagsbiblioteket'; $channelShortDescription = 'Videoer om vitenskap'; $channelDescription = 'Vitenskap formidlet fra scenen i Realfagsbiblioteket. Realfagsbiblioteket er Norges største f*g- og forskningsbibliotek innen fagområdene fagområdene fysikk, astrofysikk, biofag, farmasi, geofag, kjemi, informatikk og matematikk.'; $channelUrl = 'https://www.ub.uio.no/om/aktuelt/arrangementer/ureal/'; $channelAuthor = 'Realfagsbiblioteket'; $channelAuthorEmail = '*****@*****.**'; $channelImage = 'http://titan.uio.no/sites/default/files/thumbnails/image/realfagsbiblioteket_topp_titan.png'; $parser = new GithubMarkdown(); $writer = new \XMLWriter(); $writer->openMemory(); $writer->startDocument('1.0', 'UTF-8'); $writer->setIndent(true); $writer->setIndentString(' '); $writer->startElement('rss'); $writer->writeAttribute('version', '2.0'); $writer->writeAttribute('xmlns:media', 'http://search.yahoo.com/mrss/'); $writer->writeAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom'); $writer->writeAttribute('xmlns:dct', 'http://dublincore.org/documents/2012/06/14/dcmi-terms/'); $writer->writeAttribute('xmlns:itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); $writer->startElement('channel'); $writer->writeElement('title', $channelTitle); $writer->writeElement('link', $channelUrl); $writer->writeElement('description', $channelDescription); $writer->writeElement('itunes:subtitle', $channelShortDescription); $writer->writeElement('itunes:author', $channelAuthor); $writer->writeElement('itunes:summary', $channelDescription); $writer->startElement('itunes:owner'); $writer->writeAttribute('itunes:name', $channelAuthor); $writer->writeAttribute('itunes:email', $channelAuthorEmail); $writer->writeAttribute('href', 'https://www.ub.uio.no/om/aktuelt/arrangementer/ureal/feed-til-titan.xml'); $writer->endElement(); $writer->startElement('itunes:image'); $writer->writeAttribute('href', $channelImage); $writer->endElement(); $writer->startElement('atom:link'); $writer->writeAttribute('rel', 'self'); $writer->writeAttribute('type', 'application/rss+xml'); $writer->writeAttribute('href', 'https://www.ub.uio.no/om/aktuelt/arrangementer/ureal/feed-til-titan.xml'); $writer->endElement(); $lastModified = Carbon::createFromDate(2000, 1, 1); foreach (Recording::with('presentation', 'presentation.event')->orderBy('recorded_at', 'desc')->get() as $video) { if (!$video->presentation) { continue; } $event = $video->presentation->event; if (count($event->presentations) != 1) { continue; } $body = $parser->parse($event->intro); $body = str_replace('<hr />', '', $body); $primaryResource = null; foreach ($event->resources as $resource) { if ($resource->filetype == 'image') { $primaryResource = $resource; } } $mp4Url = null; $mp4filesize = 0; $writer->startElement('item'); $writer->startElement('guid'); $writer->writeAttribute('isPermaLink', 'false'); $writer->writeRaw($event->uuid); $writer->endElement(); //$event->start_date . ' ' . $video->presentation->start_time $writer->writeElement('pubDate', $video->presentation->getStartDateTime()->toRssString()); $writer->writeElement('dct:created', $video->presentation->getStartDateTime()->toIso8601String()); $writer->writeElement('dct:modified', $event->updated_at->toIso8601String()); $writer->writeElement('dct:language', $video->language); $writer->writeElement('title', $event->title); // $writer->writeElement('recordDate', $video->recorded_at); // $writer->writeElement('bodyLength', mb_strlen($body)); $writer->startElement('description'); $writer->writeCData($body); $writer->endElement(); $content = '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . $video->youtube_id . '" frameborder="0" allowfullscreen></iframe>'; $writer->startElement('content'); $writer->writeCData($content); $writer->endElement(); $writer->startElement('media:embed'); // ??? $writer->writeAttribute('url', $video->youtubeLink('embed')); $writer->endElement(); if (!is_null($mp4Url)) { $writer->startElement('enclosure'); $writer->writeAttribute('url', $mp4Url); $writer->writeAttribute('length', $mp4filesize); $writer->writeAttribute('type', 'video/mp4'); } if (!is_null($primaryResource)) { $writer->startElement('media:content'); $writer->writeAttribute('url', $primaryResource->url('webdav')); $writer->writeAttribute('width', $primaryResource->width); $writer->writeAttribute('height', $primaryResource->height); $writer->writeAttribute('type', 'image/jpeg'); // $writer->writeElement('attribution', $primaryResource->attribution); // Se: http://www.rssboard.org/media-rss#media-license //$writer->writeElement('media:license', $primaryResource->license); $writer->endElement(); } if ($event->updated_at > $lastModified) { $lastModified = $event->updated_at; } $writer->endElement(); } $writer->writeElement('dct:modified', $lastModified->toIso8601String()); $writer->writeElement('lastBuildDate', $lastModified->toIso8601String()); $writer->endElement(); $writer->endDocument(); echo $writer->outputMemory(); }
<span class="right"> <a href="/snippets/<?php echo Html::encode($language->slug); ?> " title="View Snippets in <?php echo Html::encode($language->name); ?> "><?php echo Html::encode($language->name); ?> </a> </span> </h4> <p><?php echo $markdown->parse($snippet->description); ?> </p> <h4>The Code <span class="right"> <a href="/snippets/<?php echo Html::encode($language->slug); ?> /<?php echo Html::encode($snippet->slug); ?> /download" title="Download this snippet as a Text File">Download</a> </span> </h4>
echo Html::a($data->title, ['#']); ?> <br/> <span class="hint-block small">Категория: <?php echo $data->category->title; ?> </span> </span> <?php echo Html::img(Yii::$app->request->baseUrl . $data->anons_img, ['class' => 'img-responsive article_anons_img']); ?> <div class="article_anons"> <?php $parser = new GithubMarkdown(); echo $parser->parse($data->anons); ?> </div> <div class="article_content"> <?php echo $parser->parse($data->post); ?> </div> <div class="article_config"> <i class="glyphicon glyphicon-calendar"></i> <?php echo Yii::$app->formatter->asDate($data->created_at); ?> | <i class="glyphicon glyphicon-user" title="Кто создал"></i> <?php echo Html::encode($data->author->username); ?>
public function descriptionAsHtml() { $parser = new GithubMarkdown(); return $parser->parse($this->description); }
public function __invoke(Filter $node, Compiler $compiler) { $parser = new Parser(); return $parser->parse($this->getNodeString($node, $compiler)); }
<?php namespace Project; require '../../header.php'; require "../../vendor/autoload.php"; require '../../include/config.php'; use cebe\markdown\GithubMarkdown; use Slim\Slim; use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd; $slim = new Slim(); //-------------------------------------------------------------------------- $slim->notFound(function () { $params = new OdaPrepareInterface(); $INTERFACE = new OdaRestInterface($params); $INTERFACE->dieInError('not found'); }); $slim->get('/', function () { $markdown = file_get_contents('./doc.markdown', true); $parser = new GithubMarkdown(); echo $parser->parse($markdown); }); $slim->get('/entity/:id', function ($id) use($slim) { $params = new OdaPrepareInterface(); $params->slim = $slim; $INTERFACE = new EntityInterface($params); $INTERFACE->get($id); }); $slim->run();
/** * Parse markdown into HTML. * @param Request $request * @return string Generated HTML */ public function postParse(Request $request) { $markdown = PostProcessor::postProcess($request->input('markdown')); return $this->parser->parse($markdown); }