Comments (5)
Without changing the selectors, LE could support <pre><code>
by changing
to
$self->{paste} = $tmp->all_text;
or by adding something like
if (my $code = $tmp->at('code')) { $tmp = $code }
above it. I'd be happy to put together a PR for either solution if you'd accept them @jhthorsen . Just let me know.
(adding a selector for body pre > code
would be fine by me too remember).
from linkembedder.
I've been giving this some more thought, and I think we should "break" LinkEmbedder by adding the fix you suggest. By "breaking" I mean that it will probably find some non-pastebin sites and render them as a pastebin. I'm thinking about blogs with code examples and such. I do think breaking it, and then later on adding better tests would be better than holding this change back.
Feel free to open a PR under these conditions (if possible)
- Add a test for a working site
- Document in the code what the selector is intended to match, so we don't accidentally break the change you want.
About the "document in the code" point: I should've done that myself, but I haven't so now we're in this situation 😞
from linkembedder.
Seems like all_text has already been implemented, so I'm going to close this issue.
Let me know if I forgot something @jberger.
from linkembedder.
...or just open a PR with a sloppy "pre" lookup, and I'll merge it.
from linkembedder.
I'm reopening this, since https://svelte.dev/docs is a case where it gets expanded to a <pre> tag when it shouldn't imo. Might also discuss if https://svelte.dev/docs#4_Prefix_stores_with_$_to_access_their_values should get rendered as a code example.
Could this be fixed simply by checking if there's a "bunch" of <pre> tags? Where bunch is more than 1 or 2..?
And even this issue: Looks like LinkEmbedder finds the code link in #24 (comment) - Thought that's probably Github.pm specific.
from linkembedder.
Related Issues (20)
- Demo doesn't work HOT 2
- A couple of predefined links in embedder.pl do not work HOT 1
- Add support for google images
- Twitter links are no longer rich media
- Improve rendering of Instagram posts, without platform.instagram.com/en_US/embeds.js
- Add support for showing source code when linking to file in a GitHub project HOT 1
- imgur images does only show title, and no image HOT 1
- paste.debian.net is not detected as a paste
- Add support for hub.docker.com
- Seems like double newlines are added to some pastebins
- t/serve.t started to fail (with newest Mojolicious?) HOT 1
- Minimum Mojolicious version? HOT 1
- Add support for https://youtu.be links
- Add support for mojopaste
- t/serve.t fails (with Mojolicious 8?) HOT 2
- Undeclared test (?) dependency Carp::Always HOT 1
- get rid of 'google can not connect' HOT 1
- add an option for the size of video thumbnail HOT 4
- Add support for Facebook video HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.