Closed suhailkc closed 4 years ago
This is not related to this plugin, you should to open this issue on highlight.js github page. Here is how to pass config to highlight.js
@NgModule({
imports: [
HighlightModule
],
providers: [
{
provide: HIGHLIGHT_OPTIONS,
useValue: {
languages: getHighlightLanguages(),
config: {
// <= here goes highlight.js config
}
}
}
],
})
export class AppModule {
}
Yea probably, It could be solved by CSS, but I have no clue
Thank your for your answer.
I tried as you are given. But not working.
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HighlightModule, HIGHLIGHT_OPTIONS } from 'ngx-highlightjs';
export function getHighlightLanguages() {
return {
xml: () => import('highlight.js/lib/languages/xml'),
typescript: () => import('highlight.js/lib/languages/typescript'),
scss: () => import('highlight.js/lib/languages/scss'),
};
}
@NgModule({
declarations: [CodePreviewComponent],
imports: [
CommonModule,
HighlightModule
],
providers: [
{
provide: HIGHLIGHT_OPTIONS,
useValue: {
languages: getHighlightLanguages(),
config: {
tabReplace: ' '
}
}
}
],
})
export class CodePreviewModule { }
The tabReplace configuration not working.
May I need to import anything extra for highlight.js configuration?
I have tried CSS for<code>
tag. but not working.
tab-size: 10;
I am sorry, I have no idea, you should consult the original repo
Bug Report or Feature Request (mark with an
x
)OS and Version?
macOS ( Catalina)
Versions
Angular CLI: 9.0.1
Repro steps
npm i ngx-highlightjs
import { HighlightModule } from 'ngx-highlightjs'; @NgModule({ imports: [ HighlightModule ] }) export class AppModule { }
Desired functionality
Tab width adjustment