diff --git a/angular.json b/angular.json index 933765bc..a2a68754 100644 --- a/angular.json +++ b/angular.json @@ -25,18 +25,8 @@ "src/favicon.256x256.png", "src/favicon.512x512.png" ], - "styles": [ - "node_modules/prismjs/themes/prism-okaidia.css", - "src/styles.css", - "src/markdown.css", - "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css" - ], - "scripts": [ - "node_modules/marked/lib/marked.js", - "node_modules/prismjs/prism.js", - "node_modules/prismjs/components/prism-csharp.min.js", - "node_modules/prismjs/components/prism-css.min.js" - ] + "styles": ["src/styles.css", "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css"], + "scripts": [] }, "configurations": { "staging": { diff --git a/package.json b/package.json index 1da91598..cd69e3f5 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "graphql-tag": "2.11.0", "karma-spec-reporter": "0.0.32", "moment": "^2.24.0", - "ngx-markdown": "^10.1.1", "ngx-mat-select-search": "^3.3.3", "node-fetch": "^2.6.9", "rxjs": "6.5.5", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7a330a7a..072271ee 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -8,7 +8,6 @@ import { HttpLink, HttpLinkModule } from 'apollo-angular-link-http'; import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; import { ApolloLink } from 'apollo-link'; import { setContext } from 'apollo-link-context'; -import { MarkdownModule, MarkedOptions } from 'ngx-markdown'; import 'reflect-metadata'; import graphqlTypes from '../../graphql/graphql-types'; import '../polyfills'; @@ -32,7 +31,6 @@ import { UserService } from './core/services/user.service'; import { IssuesViewerModule } from './issues-viewer/issues-viewer.module'; import { LabelDefinitionPopupComponent } from './shared/label-definition-popup/label-definition-popup.component'; import { HeaderComponent } from './shared/layout'; -import { markedOptionsFactory } from './shared/lib/marked'; import { RepoChangeFormComponent } from './shared/repo-change-form/repo-change-form.component'; import { SharedModule } from './shared/shared.module'; @@ -53,12 +51,6 @@ import { SharedModule } from './shared/shared.module'; ActivityDashboardModule, SharedModule, HttpClientModule, - MarkdownModule.forRoot({ - markedOptions: { - provide: MarkedOptions, - useFactory: markedOptionsFactory - } - }), AppRoutingModule, ApolloModule, HttpLinkModule diff --git a/src/app/issues-viewer/issues-viewer.module.ts b/src/app/issues-viewer/issues-viewer.module.ts index ca35689b..537960c3 100644 --- a/src/app/issues-viewer/issues-viewer.module.ts +++ b/src/app/issues-viewer/issues-viewer.module.ts @@ -1,5 +1,4 @@ import { NgModule } from '@angular/core'; -import { MarkdownModule } from 'ngx-markdown'; import { FilterBarModule } from '../shared/filter-bar/filter-bar.module'; import { IssuesPrCardModule } from '../shared/issue-pr-card/issue-pr-card.module'; import { SharedModule } from '../shared/shared.module'; @@ -8,7 +7,7 @@ import { IssuesViewerRoutingModule } from './issues-viewer-routing.module'; import { IssuesViewerComponent } from './issues-viewer.component'; @NgModule({ - imports: [FilterBarModule, IssuesViewerRoutingModule, IssuesPrCardModule, SharedModule, MarkdownModule.forChild()], + imports: [FilterBarModule, IssuesViewerRoutingModule, IssuesPrCardModule, SharedModule], declarations: [IssuesViewerComponent, CardViewComponent], exports: [IssuesViewerComponent, CardViewComponent] }) diff --git a/src/app/shared/lib/marked.ts b/src/app/shared/lib/marked.ts deleted file mode 100644 index 7b9a7002..00000000 --- a/src/app/shared/lib/marked.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { MarkedOptions, MarkedRenderer } from 'ngx-markdown'; - -export function markedOptionsFactory(): MarkedOptions { - const renderer = new MarkedRenderer(); - const linkRenderer = renderer.link; - - renderer.link = (href, title, text) => { - const html = linkRenderer.call(renderer, href, title, text); - return html.replace(/^ *:first-child { - margin-top: 0 !important; -} - -markdown > *:last-child { - margin-bottom: 0 !important; -} - -markdown a:not([href]) { - color: inherit; - text-decoration: none; -} - -markdown .anchor { - float: left; - padding-right: 4px; - margin-left: -20px; - line-height: 1; -} - -markdown .anchor:focus { - outline: none; -} - -markdown p, -markdown blockquote, -markdown ul, -markdown ol, -markdown dl, -markdown table, -markdown pre { - margin-top: 0; - margin-bottom: 16px; -} - -markdown hr { - height: 0.25em; - padding: 0; - margin: 24px 0; - background-color: #e1e4e8; - border: 0; -} - -markdown blockquote { - padding: 0 1em; - color: #6a737d; - border-left: 0.25em solid #dfe2e5; -} - -markdown blockquote > :first-child { - margin-top: 0; -} - -markdown blockquote > :last-child { - margin-bottom: 0; -} - -markdown kbd { - display: inline-block; - padding: 3px 5px; - font-size: 11px; - line-height: 10px; - color: #444d56; - vertical-align: middle; - background-color: #fafbfc; - border: solid 1px #c6cbd1; - border-bottom-color: #959da5; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #959da5; -} - -markdown h1, -markdown h2, -markdown h3, -markdown h4, -markdown h5, -markdown h6 { - margin-top: 24px; - margin-bottom: 16px; - font-weight: 600; - line-height: 1.25; -} - -markdown h1 .octicon-link, -markdown h2 .octicon-link, -markdown h3 .octicon-link, -markdown h4 .octicon-link, -markdown h5 .octicon-link, -markdown h6 .octicon-link { - color: #1b1f23; - vertical-align: middle; - visibility: hidden; -} - -markdown h1:hover .anchor, -markdown h2:hover .anchor, -markdown h3:hover .anchor, -markdown h4:hover .anchor, -markdown h5:hover .anchor, -markdown h6:hover .anchor { - text-decoration: none; -} - -markdown h1:hover .anchor .octicon-link, -markdown h2:hover .anchor .octicon-link, -markdown h3:hover .anchor .octicon-link, -markdown h4:hover .anchor .octicon-link, -markdown h5:hover .anchor .octicon-link, -markdown h6:hover .anchor .octicon-link { - visibility: visible; -} - -markdown h1 { - padding-bottom: 0.3em; - font-size: 2em; - border-bottom: 1px solid #eaecef; -} - -markdown h2 { - padding-bottom: 0.3em; - font-size: 1.5em; - border-bottom: 1px solid #eaecef; -} - -markdown h3 { - font-size: 1.25em; -} - -markdown h4 { - font-size: 1em; -} - -markdown h5 { - font-size: 0.875em; -} - -markdown h6 { - font-size: 0.85em; - color: #6a737d; -} - -markdown ul, -markdown ol { - padding-left: 2em; -} - -markdown ul ul, -markdown ul ol, -markdown ol ol, -markdown ol ul { - margin-top: 0; - margin-bottom: 0; -} - -markdown li { - word-wrap: break-all; -} - -markdown li > p { - margin-top: 16px; -} - -markdown li + li { - margin-top: 0.25em; -} - -markdown dl { - padding: 0; -} - -markdown dl dt { - padding: 0; - margin-top: 16px; - font-size: 1em; - font-style: italic; - font-weight: 600; -} - -markdown dl dd { - padding: 0 16px; - margin-bottom: 16px; -} - -markdown table { - display: block; - width: 100%; - overflow: auto; -} - -markdown table th { - font-weight: 600; -} - -markdown table th, -markdown table td { - padding: 6px 13px; - border: 1px solid #dfe2e5; -} - -markdown table tr { - background-color: #fff; - border-top: 1px solid #c6cbd1; -} - -markdown table tr:nth-child(2n) { - background-color: #f6f8fa; -} - -markdown img { - max-width: 100%; - box-sizing: content-box; - background-color: #fff; -} - -markdown img[align='right'] { - padding-left: 20px; -} - -markdown img[align='left'] { - padding-right: 20px; -} - -markdown code { - padding: 0.2em 0.4em; - margin: 0; - font-size: 85%; - background-color: rgba(27, 31, 35, 0.05); - border-radius: 3px; -} - -markdown pre { - word-wrap: normal; -} - -markdown pre > code { - padding: 0; - margin: 0; - font-size: 100%; - word-break: normal; - white-space: pre; - background: transparent; - border: 0; -} - -markdown .highlight { - margin-bottom: 16px; -} - -markdown .highlight pre { - margin-bottom: 0; - word-break: normal; -} - -markdown .highlight pre, -markdown pre { - padding: 16px; - overflow: auto; - font-size: 85%; - line-height: 1.45; - background-color: #f6f8fa; - border-radius: 3px; -} - -markdown pre code { - display: inline; - max-width: auto; - padding: 0; - margin: 0; - overflow: visible; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0; -} - -markdown .full-commit .btn-outline:not(:disabled):hover { - color: #005cc5; - border-color: #005cc5; -} - -markdown kbd { - display: inline-block; - padding: 3px 5px; - font: 11px 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; - line-height: 10px; - color: #444d56; - vertical-align: middle; - background-color: #fafbfc; - border: solid 1px #d1d5da; - border-bottom-color: #c6cbd1; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #c6cbd1; -} - -markdown :checked + .radio-label { - position: relative; - z-index: 1; - border-color: #0366d6; -} - -markdown .task-list-item { - list-style-type: none; -} - -markdown .task-list-item + .task-list-item { - margin-top: 3px; -} - -markdown .task-list-item input { - margin: 0 0.2em 0.25em -1.6em; - vertical-align: middle; -} - -markdown hr { - border-bottom-color: #eee; -} diff --git a/tests/app/shared/lib/marked.spec.ts b/tests/app/shared/lib/marked.spec.ts deleted file mode 100644 index 448bf32a..00000000 --- a/tests/app/shared/lib/marked.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MarkedOptions, MarkedRenderer } from 'ngx-markdown'; -import { markedOptionsFactory } from '../../../../src/app/shared/lib/marked'; - -describe('markedOptionsFactory', () => { - const markedOptions: MarkedOptions = markedOptionsFactory(); - const renderer: MarkedRenderer = markedOptions.renderer; - - const CUSTOM_LINK = 'www.google.com'; - const CUSTOM_TITLE = 'google'; - const CUSTOM_TEXT = 'link here'; - - it('should append all links with target=_blank', () => { - const htmlOutput: string = renderer.link(CUSTOM_LINK, CUSTOM_TITLE, CUSTOM_TEXT); - expect(htmlOutput).toContain('target="_blank"'); - }); -});