GithubHelp home page GithubHelp logo

bbcode's People

Contributors

chriskonnertz avatar kaimallea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bbcode's Issues

Ability to resize img sizes

When doing an image tag without width or height, it works fine. But with either one or both(to allow custom image sizes), it seems to not like it, could this be added?

How to customise conversion of \r \n characters?

Hi, is there a way to customise how \r\n\r\n characters are converted?

I'm looking to have \r\n\r\n become </p>\n\n<p> (wrapped in paragraph tags, first tag is last tag of previous paragraph for this example sequence).

Currently this package is producing <br/>\n<br/>\n and no paragraphs at all.

Even if I was able to turn-off the automatic <br> insertion and do it outside of this package, that would be ok.

YouTube video embedding: Allow alternative syntax

Currently, only the following syntax is valid:
[youtube]04FOUQpnGsc[/youtube]

It would be great if this could be accepted as alternative syntax:
[youtube=04FOUQpnGsc]

(The email-tag has a similar ability to have 2 possible syntaxes)

Newline after [list] generates invalid HTML

[list]
[*] Reduced enemy count in Furies Wings
...

will be converted to

<ul><br/>
</li><li> Reduced enemy count in Furies Wings<br/>
...

The line break after the <ul> is in a <li> tag which never was opened.

My proposal is to add something like "allowedChildTags" to the Tag class, so that after opening a list only [*] [li] is allowed. No idea what to if that is not the case. The keepLines behaviour needs also to be adapted.

Question: How to get data between tags?

Hi,

There's the $html variable, but this doesn't return quite what I was hoping for.

Example [html]<span>blah blah</span>[/html]

For a custom tag, I'd like to be able to get the <span>blah blah</span> content only, is that possible?

$bbcode->addTag('newhtml', function($tag, &$html, $openingTag) {
                // I'd like to do something with the internal content of the tags here
            });

Problem with javascript in source

Hi,

I want to use your bbcode-parser to parse text from a database. In some of the entries there is a HTML script-tag with javascript to show ads.

But when the parser does his 'trick', the content between the script-tags disappears and is replaced with // <!]>.

If I remove the bbcode-parser everything is fine. Is this a bug or is there an option to disable this? Below my code.

$bbcodetrans = $bbcode->render($article['content'], false, false);

Thanks!

Escape square brackets

I have got a simple question. How do I make it so this BBCode parser escapes literal square brackets?
Thank you

Problem with skip line <br />

Hello, I have a problem, I use this script for "translate" my bbcode to html but here is my text:

[b] Test 1 [/b]

[b] Test 2 [/b]

Echo:

Test1
<br />
Test2

(I put in code else br / is translate to line skip, Test1 & 2 are nicely bold)

XSS vulnerability in URL tags

I believe javascript: URLs ought to be filtered. URL tags currently allows embedding malicious inline scripts:

$bbcode = new ChrisKonnertz\BBCode\BBCode();

echo $bbcode->render("[url=javascript:alert('hacked')]malicious link[/url]");

More forgiving parser generating valid HTML

Currently I am parsing existing BBCode and you can find every possible errors. The output is this cases is not well-formed html. Any chance to get a more forgiving parser in the future?

`[img]http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/clans/28666429/702d6d88139eb439facae57989a9c6633784c519.png

[/img]
`
In this example, there's a new line (needed two to make github make a visible line break :( ) before the closing tag. The generated HTML looks like this:

<img src="http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/clans/28666429/702d6d88139eb439facae57989a9c6633784c519.png<br/> " />

and does not pass verification (nor HTMLPurifier). due to the
in the unclosed src attribute.

Then there is this code:
[url]http://store.steampowered.com/app/759750[url]
The closing slash was omitted. The result is:
<a href="http://store.steampowered.com/app/759750">http://store.steampowered.com/app/759750">store.steampowered.com/app/759750<a href="</a></a> /

The request is to make the HTML output standard compliant while including as much of the input as possible.

Nested bbcode tags

Do nested bbcode tags work? Like so:

[quote][quote]He said[/quote]she said[/quote]

Can we add single tag like [br] or [hr] ?

Hi,

I don't know if your are still updating this, but is there a way to add a single tag like [br] or [hr] ?

I did something like this :
case self::TAG_NAME_HR: $code = '<hr/>'; break;

But it's duplicating hr twice at each [hr].

Issue with BBCode.

This library has a big issue, if you for example use the bbcode "font", you can add other css to the tag by closing the first one.
[font=Arial; background-color: green;]Example[/font]
I may come up with a pull request fixing this issue.

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.