Removed prism and added cosmetics

This commit is contained in:
Cagatay Civici
2022-10-22 15:38:02 +03:00
parent 3c79cad7a2
commit 6d7da9c04c
7 changed files with 6 additions and 74 deletions

View File

@@ -1,44 +0,0 @@
pre[class*="language-"] {
border-radius: 12px !important;
&:before,
&:after {
display: none !important;
}
code {
border-left: .5rem solid transparent !important;
box-shadow: none !important;
background: var(--surface-ground) !important;
margin: 0 !important;
color: var(--surface-900);
font-size: 14px;
border-radius: 10px !important;
.token {
&.tag,
&.keyword {
color: #2196F3 !important;
}
&.attr-name,
&.attr-string {
color: #2196F3 !important;
}
&.attr-value {
color: #4CAF50 !important;
}
&.punctuation {
color: var(--text-color);
}
&.operator,
&.string {
background: transparent;
}
}
}
}

View File

@@ -1,30 +1,14 @@
import { Component, ElementRef, AfterViewInit, Input, NgModule, ViewChild, ViewEncapsulation } from '@angular/core';
import { Component, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-code',
template: `
<pre [ngClass]="'language-' + lang"><code #code><ng-content></ng-content>
</code></pre>
`,
styleUrls: ['./code.component.scss'],
encapsulation: ViewEncapsulation.None
<pre class="surface-ground p-5 border-round mb-3 overflow-auto"><code class="-mt-4 p-0 line-height-3 block" [ngStyle]="{'font-family': 'monaco, Consolas, monospace'}"><ng-content></ng-content></code></pre>
`
})
export class AppCodeComponent implements AfterViewInit {
export class AppCodeComponent {
@Input() lang = 'markup';
@ViewChild('code') codeViewChild!: ElementRef;
constructor(public el: ElementRef) { }
ngAfterViewInit() {
// @ts-ignore
if (window['Prism']) {
// @ts-ignore
window['Prism'].highlightElement(this.codeViewChild.nativeElement);
}
}
}
@NgModule({