GithubHelp home page GithubHelp logo

frickreich / bracketeer Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 121 KB

An easy to use node.js module to create double-bracket wiki links.

Home Page: https://github.com/FRickReich/Bracketeer

JavaScript 100.00%

bracketeer's Introduction

BRACKETEER

An easy to use node.js module to create double-bracket wiki links.

How to use it?

npm install bracketeer
var bracketeer = require('bracketeer');

var array = ["test", "guest", "user"];

var string = "Hey! this is a [[test]], it is just for testing purposes!"

string.bracketeer(array)

// #=> Hey! this is a <a href="/test">test</a>, it is just for testing purposes!

an array of strings is needed (best served by a database) because if the string is not found then it will put the class "missing" to the link, so you can easily style it differently.

var bracketeer = require('bracketeer');

var array = ["guest", "user"];

var string = "Hey! this is another [[test]], it is just for testing purposes!"

string.bracketeer(array)

// #=> Hey! this is a <a href="/test" class="missing">test</a>, it is just for testing purposes!

License

Copyright (c) 2013 F. Rick Reich & Ben Atkin. Licensed under the terms of the MIT license.

http://frickreich.mit-license.org/

bracketeer's People

Contributors

frickreich avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

nvdnkpr

bracketeer's Issues

escape html

right now people could put bad stuff in the links, like

[[<script type='text/javascript'>user.delete('ben');</script>]]

and it would show up as

<a href="/<script type='text/javascript'>user.delete('ben');</script>"><script type='text/javascript'>user.delete('ben');</script></a>

recommend 2 use a very tiny npm module as a dependency for escaping. I don't know which off hand. maybe lodash has a module just for escape?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.