Support » Plugin: Prismatic » Prism.js Features Such as Line Numbers Not Working For Me

  • Resolved Kevin Muldoon

    (@fonzerelli_79)


    First off, great work on the plugin Jeff. I love the simplicity of this plugin and the ability to change to different libraries.

    I’m currently writing an article about useful syntax highlighters for WordPress. I’ve been testing Prismatic on my test WordPress website and I’ve noticed that the additional features such as Line Highlight, Line Numbers, Show Language etc, are not showing. Despite being selected.

    I’m using the Prismatic block and used some sample PHP code. No other plugins are installed on the website so I don’t believe it’s a plugin conflict. The website was recently reset too.

    Am I missing a step to use these features or is there something that would cause line numbers etc not to show, even when selected?

    Thanks.
    Kevin

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hi Kevin,

    Glad to help. The plugin makes no assumptions regarding which specific line(s) should be highlighted for any given user and code snippet, etc. So after enabling line numbers (for example), you still need to add the required attribute to any pre tag that you want to highlight. For example, with Line Numbers enabled in the settings, the pre tag should look like this:

    <pre data-line="2">

    That would highlight the second line. You can find which attributes are required for the various Prism plugins by visiting the respective page on the Prism.js website. Linked infos also available in the plugin documentation under the section, “Usage: Prism.js Plugins”.

    I hope this helps, let me know if I can provide any further infos.

    Thread Starter Kevin Muldoon

    (@fonzerelli_79)

    Many thanks for replying so quickly. Much appreciated.

    I had reviewed the plugin documentation area previously, but I had wrongly assumed that it wouldn’t be necessary to use CSS classes if the additional features were selected in the settings area.

    Once I started applying a few CSS classes, it was easy to understand. 🙂

    Plugin Author Jeff Starr

    (@specialk)

    I will update the docs/readme to make it more clear what is required for each of the Prism plugins. I appreciate your feedback, Kevin.

    Hey Guys, Where to find the classes to use for each feature selected in settings.

    Also, is it possible that i do not have to add the classes to each post where i write the code. Can it not be applied from one central place across whole site where i am using prismatic code block.

    I want to show Line Numbers and i do not want to add the class on every post. Please let me know if there is a solution.

    Thanks

    Plugin Author Jeff Starr

    (@specialk)

    Hey @makhijajatin, glad to help:

    1) “Where to find the classes to use for each feature selected in settings.”

    next to each setting for line numbers, etc., you will find a link to the official documentation. That is where you can find the required steps, classes, etc. for each feature.

    2) “is it possible that i do not have to add the classes to each post where i write the code.”

    Not currently, but it’s on the list of suggestions for possible future update.

    I hope this helps, let me know if I can provide any further infos.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Prism.js Features Such as Line Numbers Not Working For Me’ is closed to new replies.