Git Product home page Git Product logo

Comments (5)

jberger avatar jberger commented on June 7, 2024

Without changing the selectors, LE could support <pre><code> by changing

$self->{paste} = $tmp->text;

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.

jhthorsen avatar jhthorsen commented on June 7, 2024

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.

jhthorsen avatar jhthorsen commented on June 7, 2024

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.

jhthorsen avatar jhthorsen commented on June 7, 2024

...or just open a PR with a sloppy "pre" lookup, and I'll merge it.

from linkembedder.

jhthorsen avatar jhthorsen commented on June 7, 2024

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)

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.