Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<mark> tag not working with language attribute #465

Closed
talal opened this issue Jan 10, 2015 · 3 comments
Closed

<mark> tag not working with language attribute #465

talal opened this issue Jan 10, 2015 · 3 comments

Comments

@talal
Copy link

talal commented Jan 10, 2015

When I use the <mark> tag to highlight some piece of code inside the <pre><code> tags without specifying the language then it works as expected and the code is highlighted.

This works:

<pre><code>ssh <mark>user</mark>@ip address</code></pre>

But when I use it inside <pre><code> with the language specified, it doesn't work and the text wrapped inside <mark> tags is not highlighted.

This doesn't work:

<pre><code class="language-bash">ssh <mark>user</mark>@ip address</code></pre>

I have also tried adding a custom class at the end of the prism.css file:

.highlight {
    background-color: #000;
    color: #FFC336;
}

Then, I used the following syntax:

<pre><code class="language-bash">ssh <span class="highlight">user</span>@ip address</code></pre>

Adding a custom class didn't work either.

I have also tried this with other languages, still didn't work:

<pre><code class="language-javascript">
database: {
    client: 'sqlite3',
    connection: {
        filename: path.join(__dirname, '/content/data/ghost.db')
    },
    debug: <mark>false</mark>
}
</code></pre>

Any help on this issue would be much appreciated. Thanks in advance.

@vkbansal
Copy link
Contributor

Yes, this is bound to happen as prism strips all the pre-existing tags as specified in the documentation.
http://prismjs.com/#limitations

I'm not aware of the apparent workarounds mentioned though. May be someone else will be able to help you.

@talal
Copy link
Author

talal commented Jan 10, 2015

@vkbansal Thank you for your help. I was able to resolve the issue by breaking the block of code as mentioned on the Prism FAQ.

@apfelbox
Copy link
Contributor

You could highlight it with prism and add your <mark></mark> tag after the highlighting is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants