Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeds in <pre> tags #92

Open
sunnysingh opened this issue May 28, 2015 · 3 comments
Open

Embeds in <pre> tags #92

sunnysingh opened this issue May 28, 2015 · 3 comments

Comments

@sunnysingh
Copy link

Essence does not take into consideration when URLs are posted within <pre><code> tags. Since these tags (code blocks) are normally used for demonstrating code, I don't want a URL that happens to be a provider to be parsed within these code blocks.

I believe this should be a config option in Essence, or at the very least how would I be able to do this myself?

@felixgirault felixgirault self-assigned this May 28, 2015
@felixgirault
Copy link
Member

Nice catch, I didn't thought about that!
However, Essences uses a regex to find replaceable URLs, so it may be really tricky to handle this case...

If you are using the version 2 of Essence, you can use the urlPattern property:

$Essence = Essence::instance();
$Essence->urlPattern = '/pattern/i';

See https://github.com/essence/essence/blob/2.0/lib/Essence/Essence.php#L85-L97 for the current pattern.

If you are using the upcoming version 3 (master actually), you can configure the pattern on instanciation:

$Essence = new Essence([
    'Replacer.urlPattern' => '/pattern/i'
]);

See https://github.com/essence/essence/blob/master/lib/Essence/Di/Container/Standard.php#L398-L405 in this case.

But again, using a regex could be complicated. So maybe you will have to implement your own logic, by extracting URLs yourself and using Essence to extract informations.

Let me know if you find a way of doing that, so maybe I can integrate it directly into the lib.

@sunnysingh
Copy link
Author

Thanks for the quick reply! I posted the same question on a similar library and received a solution that I could implement: mpratt/Embera#22 (comment)

Obviously this can be used with either Embera or Essence, since the logic for ignoring the <pre> tags is simply used before and after the parser. I'm currently using the code outside of the library as a quick patch, but I would love it if you implemented this into Essence itself.

@felixgirault
Copy link
Member

I'll keep this issue open to remember it, hopefully I'll find a simple way to implement this :)

@felixgirault felixgirault added this to the Version 3.1 milestone Jun 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants