Skip to content

Commit 1b4ddad

Browse files
authored
Merge pull request #343 from 0x41head/activity-desc
feature: added markdown rendering to activity desc in circular heatmap
2 parents 98c70bc + 9c33198 commit 1b4ddad

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/app/component/circular-heatmap/circular-heatmap.component.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,19 @@ <h2>Nothing to show</h2>
4545
</mat-panel-title>
4646
</mat-expansion-panel-header>
4747
<ng-template matExpansionPanelContent>
48-
<p [innerHTML]="activityDetails.description"></p>
48+
<div
49+
*ngIf="
50+
markdown.render(activityDetails.description);
51+
else ifFileIsNotAMarkdown
52+
">
53+
<p
54+
[innerHTML]="
55+
markdown.render(activityDetails.description)
56+
"></p>
57+
</div>
58+
<ng-template #ifFileIsNotAMarkdown>
59+
<p [innerHTML]="activityDetails.description"></p>
60+
</ng-template>
4961
</ng-template>
5062
</mat-expansion-panel>
5163
<mat-expansion-panel

src/app/component/circular-heatmap/circular-heatmap.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as d3 from 'd3';
1010
import * as yaml from 'js-yaml';
1111
import { Router } from '@angular/router';
1212
import { MatChip } from '@angular/material/chips';
13+
import * as md from 'markdown-it';
1314

1415
export interface activitySchema {
1516
uuid: string;
@@ -56,6 +57,7 @@ export class CircularHeatmapComponent implements OnInit {
5657
segment_labels: string[] = [];
5758
activityDetails: any;
5859
showOverlay: boolean;
60+
markdown: md = md();
5961

6062
constructor(
6163
private yaml: ymlService,

0 commit comments

Comments
 (0)