Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(addon-doc): add header #58

Merged
merged 9 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@
"stylePreprocessorOptions": {
"includePaths": ["projects/core/styles"]
},
"scripts": ["node_modules/marked/lib/marked.js"],
"scripts": [
"node_modules/prismjs/prism.js",
"node_modules/marked/lib/marked.js"
],
"es5BrowserSupport": true
},
"configurations": {
Expand Down
139 changes: 78 additions & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@
"@angular/platform-server": "^9.1.12",
"@angular/router": "~9.1.12",
"@angularclass/hmr": "^2.1.3",
"@ng-web-apis/common": "1.7.0",
"@ng-web-apis/intersection-observer": "2.0.1",
"@ng-web-apis/common": "1.9.0",
"@ng-web-apis/intersection-observer": "2.1.0",
"@ng-web-apis/mutation-observer": "1.1.0",
"@ng-web-apis/resize-observer": "1.0.3",
"@ng-web-apis/universal": "^1.6.0",
"@ng-web-apis/universal": "1.9.2",
"@tinkoff/angular-contenteditable-accessor": "1.1.0",
"@tinkoff/ng-dompurify": "3.0.0",
"@tinkoff/ng-event-plugins": "1.0.1",
"@tinkoff/ng-event-plugins": "2.0.0",
"@tinkoff/ng-polymorpheus": "2.1.0",
"angular2-text-mask": "9.0.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.6.9",
"dompurify": "1.0.11",
"highlight.js": "^9.15.5",
"ngx-highlightjs": "3.0.3",
"ngx-markdown": "^8.2.1",
"dompurify": "^2.2.3",
"highlight.js": "^10.4.1",
"ngx-highlightjs": "^4.1.3",
"ngx-markdown": "^11.0.1",
"preboot": "^7.0.0",
"rxjs": "~6.6.3",
"tslib": "^1.10.0",
Expand All @@ -92,7 +92,7 @@
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@tinkoff/linters": "^0.6.0",
"@types/dompurify": "^0.0.32",
"@types/dompurify": "^2.0.4",
"@types/express": "4.16.1",
"@types/jasmine": "~3.3.15",
"@types/jasmine-ajax": "^3.1.40",
Expand Down Expand Up @@ -129,7 +129,6 @@
"ts-loader": "^5.3.3",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"tslint-teamcity-reporter": "^3.2.2",
"typescript": "~3.8.3"
},
"husky": {
Expand Down
23 changes: 8 additions & 15 deletions projects/addon-doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,11 @@ npm i @taiga-ui/addon-doc

2. Configure languages to highlight in your main module:

```typescript
import * as typescript from 'highlight.js/lib/languages/typescript';
import {HighlightLanguage} from 'ngx-highlightjs';

/**
* Import every language you wish to highlight here
* NOTE: The name of each language must match the file name its imported from
*/
export function hljsLanguages(): ReadonlyArray<HighlightLanguage> {
return [{name: 'typescript', func: typescript}];
}
```

```typescript
import {NgModule} from '@angular/core';
import {TuiDocMainModule} from '@taiga-ui/addon-doc';
import {hljsLanguages} from './hljsLanguages';
import {HIGHLIGHT_OPTIONS} from 'ngx-highlightjs';
import {HIGHLIGHT_OPTIONS, HighlightLanguage} from 'ngx-highlightjs';
import {AppComponent} from './app.component';

@NgModule({
Expand All @@ -60,7 +47,13 @@ npm i @taiga-ui/addon-doc
{
provide: HIGHLIGHT_OPTIONS,
useValue: {
languages: hljsLanguages,
coreLibraryLoader: () => import('highlight.js/lib/core'),
lineNumbersLoader: () => import('highlightjs-line-numbers.js'), // Optional, only if you want the line numbers
languages: {
typescript: () => import('highlight.js/lib/languages/typescript'),
less: () => import('highlight.js/lib/languages/less'),
xml: () => import('highlight.js/lib/languages/xml'),
},
},
},
],
Expand Down
6 changes: 3 additions & 3 deletions projects/addon-doc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"@taiga-ui/core": "1.6.5",
"@taiga-ui/kit": "1.6.5",
"schematics-utilities": "1.0.1",
"highlight.js": "^9.15.5",
"ngx-highlightjs": "3.0.3"
"highlight.js": "^10.0.0",
"ngx-highlightjs": "^4.0.0"
},
"devDependencies": {
"@taiga-ui/core": "1.6.5",
"@taiga-ui/kit": "1.6.5"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<p *ngIf="filename" class="header">{{filename}}</p>
<pre class="code"><code [highlight]="code"></code></pre>
<pre class="code"><code [lineNumbers]="true" [highlight]="code"></code></pre>
6 changes: 3 additions & 3 deletions projects/addon-doc/src/components/demo/demo.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<tui-tooltip size="l" describeId="form" [content]="tooltip">
<ng-template #tooltip>
{{texts[0]}}
<a tuiLink tuiMode="light" routerLink="/tui-mode"
><code>tuiMode</code></a
>
<a tuiLink tuiMode="light" routerLink="/tui-mode">
<code>tuiMode</code>
</a>
</ng-template>
</tui-tooltip>
<div tuiGroup class="tui-space_left-3" [collapsed]="true">
Expand Down
2 changes: 2 additions & 0 deletions projects/addon-doc/src/components/main/main.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {TuiDialogModule, TuiNotificationsModule, TuiRootModule} from '@taiga-ui/core';
import {TuiDocHeaderModule} from '../../internal/header/header.module';
import {TuiDocNavigationModule} from '../navigation/navigation.module';
import {TuiDocMainComponent} from './main.component';

@NgModule({
imports: [
CommonModule,
RouterModule,
TuiDocHeaderModule,
TuiRootModule,
TuiDialogModule,
TuiNotificationsModule,
Expand Down
Loading