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

feat(prism): add data-language attribute #177

Merged
merged 2 commits into from Jan 31, 2020
Merged

Conversation

@SukkaW
Copy link
Member

SukkaW commented Jan 26, 2020

Add data-language attribute to <pre> tag.

It is necessary to have data-language attribute to be compatible with Prism's Show Languages Plugin: https://prismjs.com/plugins/show-language/

Besides that, with this attribute theme developer can even show current language without that plugin as well:

pre::before {
    color: #bcc3ce;
    content: attr(data-language); /* This looks important */
    font-size: .7rem;
    position: absolute;
    right: .4rem;
    top: .1rem;
}

will resulted in (The HTML string on top of the right):

image

@SukkaW SukkaW requested review from seaoak and hexojs/core Jan 26, 2020
@coveralls

This comment has been minimized.

Copy link

coveralls commented Jan 26, 2020

Coverage Status

Coverage increased (+0.005%) to 96.998% when pulling cc0e42f on SukkaW:prism-data-language into 4e7c24e on hexojs:master.

@seaoak

This comment has been minimized.

Copy link
Member

seaoak commented Jan 31, 2020

When no lang is specified,
this patch add the attribute data-language="plain".

Is this behavior intended by Prism's show-language plugin?

Maybe adding no attribute be better?

@SukkaW

This comment has been minimized.

Copy link
Member Author

SukkaW commented Jan 31, 2020

this patch add the attribute data-language="plain".

Emmm, it will add data-language="none" instead. I will push a fix to handle this.

@seaoak
seaoak approved these changes Jan 31, 2020
Copy link
Member

seaoak left a comment

Thanks! LGTM.

@SukkaW SukkaW merged commit 7e084de into hexojs:master Jan 31, 2020
3 checks passed
3 checks passed
Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls Coverage increased (+0.005%) to 96.998%
Details
@SukkaW SukkaW mentioned this pull request Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.