Astronaut Library .js
CodeViewer
Make viewing your codes more attractive and beautiful in your projects.
How to use:
Attributes HTML Independents
• Effects will be applied only on div.ast-codeviewer that inserted these attributes.
| Name | Values | Description |
|---|---|---|
| data-lang | Languages | Defines the language of the code that will be displayed |
| data-title | Title | Define a title, eg: index.html |
| data-width data-height |
Measure | Set the height and width |
| data-copy | true/false | Enable/Disable copy code button |
| data-hyperlink | true/false | Enable/Disable copy hyperlink button |
| data-blur | true/false | Enable/Disable blur in background |
| data-run | true/false | Enable/Disable code javascript execute button |
Opções:
| Option | Type | Value | Description |
|---|---|---|---|
| lineNumber: | Boolean/Object | true/{object} | Enable line numbers and/or set style |
| style: | Object | {object} | Define your stylizations |
| buttons: | Object | {object} | Enable/Disable Action Buttons |
• style:
Define your stylizations
| Option | Type | Default | Description |
|---|---|---|---|
| fontSize: | String | 0.9rem | Set font size |
| fontFamily: | String | Fira Code, 'system-ui' | Defines the font type |
| background: | String | Set a background color | |
| color: | String | Set the default font color | |
| windowBar: | Boolean/String | Show/Hide Window Bar and Set Background Color | |
| blur: | String | 0 | Apply blur in the background |
| width: | String | 100% | Defines the width of the window |
| height: | String | auto | Defines the height of the window |
| boxShadow: | String | none | Define a Box-Shadow |
| borderRadius: | String | 0.6rem | Defines the rounded edge |
| theme: | String | copilot | Define a Theme |
Examples:
• buttons:
Enable/Disable Action Buttons
| Option | Type | Default | Description |
|---|---|---|---|
| hyperlink | Boolean | false | Enable/Disable code window hyperkink button, required window to have |
| copy | Boolean | false | Enable / Disable Copy Code Button |
| position | String | window | Set the position of the buttons, |
| color | String | Sets the color of the icons | |
| backgroundHover | String | Set hover background color |
Examples: