GithubHelp home page GithubHelp logo

Comments (6)

Snapstromegon avatar Snapstromegon commented on June 16, 2024 2

I would personally do this as a shortcode instead of an after, because with eleventy.after you'd need to extract the code to highlight yourself, which can be hard to impossible.
For markdown highlighting there exists an eleventyConfig.addMarkdownHighlighter(), but I think it's undocumented.

If I were to implement it, I'd probably keep it close to this plugin.

from eleventy-plugin-syntaxhighlight.

Snapstromegon avatar Snapstromegon commented on June 16, 2024

I strongly oppose "upgrading" to Torchlight with their current licensing model and the fact that their clients interact with an API.

This might be okay to integrate as an optional feature with big warning signs (or even better, a seperate plugin), but switching over completely would make this plugin inaccessible to many projects and 11ty users.

Although Tochlight definetly has some really nice features.

from eleventy-plugin-syntaxhighlight.

zachleat avatar zachleat commented on June 16, 2024

Ah yeah, show up super late here to say that Torchlight can absolutely live as a separate plugin! All of the hooks should be available!

from eleventy-plugin-syntaxhighlight.

aaronstezycki avatar aaronstezycki commented on June 16, 2024

Noted! Hadn't thought of any issues facing the licensing model. Most (just assuming) are using for a personal/open source project, but that's fair to point out.

@zachleat Out of interest and off the top of my head, and example of implementing this would be to use eleventy.after and compiling the output with Torchlight?

module.exports = function (eleventyConfig) {
  // Async-friendly in 1.0+
  eleventyConfig.on('eleventy.after', async () => {
    // Run me after the build ends
  });
};

from eleventy-plugin-syntaxhighlight.

aaronstezycki avatar aaronstezycki commented on June 16, 2024

I guess the only reason I mentioned the eleventy.after is that one of Torchlights build processes is from standalone CLI, so thought that would be an easy route to use the CLI to process the html after 11ty has built it. I'm unaware of any Torchlight integration directly into a js/11ty pipeline that would work, but I'm not very experienced with Torchlight.

Thanks for the direction though, will try to learn and take a look into it. :)

from eleventy-plugin-syntaxhighlight.

Snapstromegon avatar Snapstromegon commented on June 16, 2024

Ahh, looking at the docs, I see what you mean.
It would probably be viable to use the CLI that way, but it would also force the user to use torchlight for all syntax highlighting (in a file) instead of for specific code blocks (e.g. when comparing syntax highlighters).

You could use their API directly, as you just need to post an object to https://api.torchlight.dev/highlight, but if you do that for each code block, you might hit rate limits fairly soon.

In general I would personally right now avoid this tool (except for experimentation), because rate limits are really low (for the commercial option) or unknown and the docs seem nice, but lack some information or are outdated (like the link to the remark plugin).

from eleventy-plugin-syntaxhighlight.

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.