@covalent/markdown 3.1.2-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ ## TdMarkdownComponent: td-markdown
2
+
3
+ `<td-markdown>` is a component that parses and renders Github flavored markdown. It is based on the [showdown](https://github.com/showdownjs/showdown/) library.
4
+
5
+ **Note:** This module uses the **DomSanitizer** service to sanitize the parsed html from the showdown lib to avoid **XSS** issues.
6
+
7
+ By default, `--dev` build will log the following message in the console to let you know:
8
+
9
+ `WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).`
10
+
11
+ ## API Summary
12
+
13
+ #### Inputs
14
+
15
+ + content?: string
16
+ + Markdown format content to be parsed as html markup.
17
+ + Used to load data dynamically. e.g. `README.md` content.
18
+
19
+ + simpleLineBreaks?: string
20
+ + Sets whether newline characters inside paragraphs and spans are parsed as <br/>.
21
+ + Defaults to false.
22
+
23
+ + hostedUrl?: string
24
+ + If markdown contains relative paths, this is required to generate correct urls.
25
+
26
+ + anchor?: string
27
+ + Anchor to jump to.
28
+
29
+ #### Events
30
+
31
+ + contentReady: undefined
32
+ + Event emitted after the markdown content rendering is finished.
33
+
34
+
35
+ ## Installation
36
+
37
+ This component can be installed as an npm package.
38
+
39
+ ```bash
40
+ npm i -save @covalent/markdown
41
+ ```
42
+
43
+ ## Setup
44
+
45
+ Then, import the **CovalentMarkdownModule** in your NgModule:
46
+
47
+ ```typescript
48
+ import { CovalentMarkdownModule } from '@covalent/markdown';
49
+ @NgModule({
50
+ imports: [
51
+ CovalentMarkdownModule,
52
+ ...
53
+ ],
54
+ ...
55
+ })
56
+ export class MyModule {}
57
+ ```
58
+
59
+ ### Theming
60
+
61
+ This module comes with its own Covalent theme which uses the material theme which is used by importing our theme scss file.
62
+
63
+ ```scss
64
+ @import '~@angular/material/theming';
65
+ @import '~@covalent/markdown/markdown-theme';
66
+
67
+ @include mat-core();
68
+
69
+ $primary: mat-palette($mat-orange, 800);
70
+ $accent: mat-palette($mat-light-blue, 600, A100, A400);
71
+ $warn: mat-palette($mat-red, 600);
72
+
73
+ $theme: mat-light-theme($primary, $accent, $warn);
74
+
75
+ @include covalent-markdown-theme($theme);
76
+ ```
77
+
78
+ ## Example
79
+
80
+ **Html:**
81
+
82
+ ```html
83
+ <td-markdown>
84
+ # Heading
85
+ ## Sub Heading (H2)
86
+ ### Steps (H2)
87
+ </td-markdown>
88
+ ```
89
+
90
+ **Output:**
91
+
92
+ # Heading
93
+ ## Sub Heading (H2)
94
+ ### Steps (H2)
@@ -0,0 +1,57 @@
1
+ @import '../../../node_modules/@angular/material/theming';
2
+
3
+ @mixin covalent-markdown-theme($theme) {
4
+ $accent: map-get($theme, accent);
5
+ $foreground: map-get($theme, foreground);
6
+ $background: map-get($theme, background);
7
+ td-markdown {
8
+ a {
9
+ color: mat-color($accent);
10
+ }
11
+ h1,
12
+ h2 {
13
+ border-bottom-color: mat-color($foreground, divider);
14
+ }
15
+ h3,
16
+ h4,
17
+ h5,
18
+ h6 {
19
+ color: mat-color($foreground, secondary-text);
20
+ }
21
+ hr {
22
+ border-color: mat-color($foreground, divider);
23
+ }
24
+ blockquote {
25
+ color: mat-color($foreground, secondary-text);
26
+ border-left-color: mat-color($foreground, divider);
27
+ }
28
+ table {
29
+ th,
30
+ td {
31
+ border-color: mat-color($foreground, dividers);
32
+ }
33
+ tr {
34
+ border-top-color: mat-color($foreground, dividers);
35
+ &:nth-child(2n) {
36
+ background-color: mat-color($foreground, dividers);
37
+ }
38
+ }
39
+ }
40
+ img {
41
+ background-color: mat-color($background, card);
42
+ }
43
+ code {
44
+ background-color: mat-color($background, hover);
45
+ }
46
+ .highlight pre,
47
+ pre {
48
+ background-color: mat-color($background, app-bar);
49
+ }
50
+ kbd {
51
+ color: mat-color($foreground, secondary-text);
52
+ background-color: mat-color($background, app-bar);
53
+ border-color: mat-color($foreground, divider);
54
+ border-bottom-color: mat-color($foreground, disabled);
55
+ }
56
+ }
57
+ }