Giter VIP home page Giter VIP logo

Comments (7)

rebron1900 avatar rebron1900 commented on June 3, 2024 1

https://discord.com/channels/741017160297611315/1022195881698672650/threads/1189062692636471436
done

from eleventy.

uncenter avatar uncenter commented on June 3, 2024

Looks like you can't do it statically but they have a guide on syntax highlighting on the client side, see https://ghost.org/tutorials/code-snippets-in-ghost/#add-prism-via-code-injection. You can use the same code snippets in your Eleventy layouts/templates.

from eleventy.

rebron1900 avatar rebron1900 commented on June 3, 2024

Looks like you can't do it statically but they have a guide on syntax highlighting on the client side, see https://ghost.org/tutorials/code-snippets-in-ghost/#add-prism-via-code-injection. You can use the same code snippets in your Eleventy layouts/templates.

Can I do it if I can get the content of the article in markdown format?

from eleventy.

uncenter avatar uncenter commented on June 3, 2024

Yep, with the markdown content you can do it during the build instead of on the client.

from eleventy.

rebron1900 avatar rebron1900 commented on June 3, 2024

Yep, with the markdown content you can do it during the build instead of on the client.

But Ghost's database doesn't actually store markdown at all. It's all escaped HTML code, sigh.
Can I handle it through 11ty's Transform feature?
I tried using jsdom and prismjs library, but it failed. What should I do?

const jsdom = require('jsdom')
const { JSDOM } = jsdom
const prismjs = require('prismjs')

module.exports = (content, outputPath) => {
  if (outputPath.endsWith('.html')) {
    const DOM = new JSDOM(content)
    const document = DOM.window.document

    prismjs.highlightAll(document)

from eleventy.

uncenter avatar uncenter commented on June 3, 2024

Can you send your repository? What error did you get? What does the HTML look like of the code blocks Ghost returns in the API? This might be easier if you create a forum post over on the Discord, you'll get faster responses.

from eleventy.

rebron1900 avatar rebron1900 commented on June 3, 2024

Can you send your repository? What error did you get? What does the HTML look like of the code blocks Ghost returns in the API? This might be easier if you create a forum post over on the Discord, you'll get faster responses.

Thanks, I'm going now.

from eleventy.

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.