Plugin to inject a data-lang attribute for Expressive Code, a text marking & annotation engine for presenting source code on the web.
npm install expressive-code-plugin-data-langdata-lang="" attribute onto the root HTML element of the code block (usually the Frame element).
js
// astro.config.js
import { defineConfig } from "astro/config";
import expressiveCode from "astro-expressive-code";
import { pluginDataLang } from "expressive-code-plugin-data-lang";
export default defineConfig({
integrations: [
expressiveCode({
plugins: [pluginDataLang()],
}),
],
});
`
$3
`css
.expressive-code .frame::after {
content: attr(data-lang);
position: absolute;
right: 1em;
bottom: 1em;
opacity: 0.7;
}
``