GitXplorerGitXplorer
j

bearhug

public
15 stars
0 forks
2 issues

Commits

List of commits on branch master.
Unverified
4e98b7d09ff4a1cab5846c9ba5fd83c6a0fe4a90

Merge pull request #1 from benesch/master

jjharding committed 11 years ago
Unverified
9f3f5008563a4fef780b0322568a3b1e251d422c

Fix misspelling of Bearhug description in README

bbenesch committed 11 years ago
Unverified
7366a553516f60693e8c008aac97db79b1f5fe0e

Add license.

committed 11 years ago
Unverified
4c285c6c83ebfe6fde5feb4e972de693909c4669

0.1.0

committed 11 years ago
Unverified
08bb60dda111a40ac94538d638e43cbfc31d9d55

Add README.

committed 11 years ago
Unverified
f8b1b07e4bd33dbd8f06b9c798b787dd86b8d188

Set up travisci.

committed 11 years ago

README

The README file for this repository.

build status

Bearhug

Bearhug wraps text patterns with configurable html tags. It's fast, flexible, and best of all, has no dependencies.

Download

Usage

Options

The available options that can be passed to window.bearhug.

  • node – The element to wrap patterns within. Required.

  • pattern – A pattern or an array of patterns that bearhug will wrap. Required.

  • tagName – The tag name of the element matched patterns will be wrapped in. Defaults to strong.

  • className – The class of the element matched patterns will be wrapped in.

  • wordsOnly – If true, only whole words will be matched and wrapped. Defaults to false.

  • caseSensitive – If true, pattern matching will be case sensitive. Defaults to false.

Example

<!DOCTYPE html>
<html>
  <head>
    <script src="/bearhug.js"></script>
  </head>
  <body>
    <article id="hipster-ipsum">
      <p>Craft beer cardigan trust fund, swag tumblr pork belly kale chips
      vegan plaid ethical artisan. Mumblecore wolf leggings cornhole before
      they sold out trust fund. Keffiyeh shabby chic pug Pinterest
      letterpress.<p>
    </article>

    <script>
      var node = document.getElementById('hipster-ipsum');

      bearhug({ node: node, pattern: ['beer', 'wolf'], className: 'stuff' })
    </script>
  </body>
</hmtl>

Testing

Tests are written using Jasmine and ran with Karma. To run Bearhug's test suite with PhantomJS, run npm test.

Issues

Found a bug? Create an issue on GitHub.

https://github.com/jharding/bearhug/issues

Versioning

For transparency and insight into the release cycle, releases will be numbered with the follow format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backwards compatibility bumps the major
  • New additions without breaking backwards compatibility bumps the minor
  • Bug fixes and misc changes bump the patch

For more information on semantic versioning, please visit http://semver.org/.

License

Copyright (c) 2013 Jake Harding
Licensed under the MIT License.