Coder Social home page Coder Social logo

Comments (5)

taylorzane avatar taylorzane commented on August 23, 2024

P.S. Currently I'm getting around this using the syntax:

pre(class='language-coffeescript')
  code(class='language-coffeescript').
    foo = (bar) ->
      # etc...

from metalsmith-prism.

robmcguinness avatar robmcguinness commented on August 23, 2024

metalsmith-prism is just a wrapper around Prism.js I believe it only works with the <code> tag.

I'm not sure why the highlighting isn't properly formatted without <pre> tag but when I have a minute I'll take a peek.

from metalsmith-prism.

taylorzane avatar taylorzane commented on August 23, 2024

Well I did a quick hack to lib/index.js and changed it to $(options.tagName || 'code') and I'm able to highlight anything.

I can submit a PR, I just didn't know if the maintainer had a preferred way to do this. I figured I'd open a discussion about it prior to making any modifications.

Example:
image

from metalsmith-prism.

robmcguinness avatar robmcguinness commented on August 23, 2024

Seems simple enough. In the PR:

  • include unit test
  • update the README options section

I can cut a release today as soon as everything passes.

from metalsmith-prism.

robmcguinness avatar robmcguinness commented on August 23, 2024

It looks like Prism automatically adds the appropriate language class prism.js#L731 to the <pre> parent but only when the function fileHighlight() is run on DOMContentLoaded...which is never trigged with this plugin.

Would adding that same behavior into this plugin satisfy your request? I'm trying to stay as close to the Prism.js concepts as much as possible.

Under Basic Usage

Prism does its best to encourage good authoring practices. Therefore, it only works with <code> elements, since marking up code without a <code> element is semantically invalid.

from metalsmith-prism.

Related Issues (10)

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.