Skip to content

Question: commonmark-attributes-extension Add attribute to <pre> tag? #611

Description

@rob4226

Hi,
With regards to the commonmark-attributes-extension, I've tried many different ways but I can't figure out how to add an attribute to the <pre> tag in a fenced code block. When I try, it ends up adding the attribute to a <code> tag inside the <pre> tag. The reason I ask is for line highlighting with the PrismJS line highlighting extension. You must add a data-line="4-6" attribute to the <pre> tag to highlight the lines you want.

'''typescript
console.log('test');
'''
{:data-line="1"}

I tried the above but like I said it adds it to a <code> tag. How would I target a fenced code block's <pre> tag?

Thank you for PHP CommanMark, love it!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionGeneral questions about the project or usage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions