Overview
The LanguageName extension displays a language name on the top of a code snippet.
.button { $root: &; font-family: Roboto, 'Avenir Next Pro', sans-serif; font-size: .9rem; &--primary { color: white; #{ $root }__inner { background: $main-color; } } }
It works with the Copy extension:
console.log( 'Hi!' );
Usage
Register Overlay and LanguageName extensions:
import { RyuseiLight, Overlay, LanguageName } from '@ryusei/light'; RyuseiLight.compose( { Overlay, LanguageName } );
Or import the extension files:
<script src="path-to-the-file/overlay.min.js"></script> <script src="path-to-the-file/language-name.min.js"></script>
Then, set the languageName
option to true
:
const ryuseilight = new RyuseiLight(); ryuseilight.apply( 'pre', { languageName: true } ); // or enables it as default: const ryuseilight = new RyuseiLight( { languageName: true } ); ryuseilight.apply( 'pre' );
If you want to display the name on the left side, set the value to 'topLeft'
:
ryuseilight.apply( 'pre', { languageName: 'topLeft' } );
Now the name will move to the left:
console.log( 'Hello!' );