2017 © Pedro Peláez
 

library commonmark-searchhighlight-extension

Extension for CommonMark PHP implementation to highlight search strings in Markdown files

image

mindkomm/commonmark-searchhighlight-extension

Extension for CommonMark PHP implementation to highlight search strings in Markdown files

  • Monday, March 6, 2017
  • by gchtr
  • Repository
  • 3 Watchers
  • 3 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SearchHighlight Extension

SearchHighlight is an extension for the CommonMark PHP implementation and can be used to highlight Markdown text that matches a search string., (*1)

The extension adds a <span class="search-highlight"> around the strings that match the search string., (*2)

Example for "something":, (*3)

, (*4)

Installation

This project can be installed via Composer:, (*5)

composer require mindkomm/commonmark-searchhighlight-extension

Usage

use League\CommonMark\Environment;
use League\CommonMark\CommonMarkConverter;

use Mind\CommonMark\SearchHighlightExtension\SearchHighlightExtension;

$searchstring = 'Your search string';
$config = [];

$environment = Environment::createCommonMarkEnvironment();

if (!empty($searchstring)) {
    // Pass the search string to the constructor.
    $environment->addExtension(new SearchHighlightExtension($searchstring));
}

$converter = new CommonMarkConverter($config, $environment);

echo $converter->convertToHtml('A text that contains your search string.');

The Versions

06/03 2017

dev-master

9999999-dev https://github.com/mindkomm/commonmark-searchhighlight-extension

Extension for CommonMark PHP implementation to highlight search strings in Markdown files

  Sources   Download

MIT

The Requires

 

search markdown highlight commonmark

06/03 2017

1.0.0

1.0.0.0 https://github.com/mindkomm/commonmark-searchhighlight-extension

Extension for CommonMark PHP implementation to higlight search strings in Markdown files

  Sources   Download

MIT

The Requires

 

search markdown highlight commonmark