Skip to content

Commit

Permalink
regex fix to remove unneeded commas
Browse files Browse the repository at this point in the history
  • Loading branch information
OgunyemiO committed Sep 12, 2024
1 parent 237fafc commit 79d0ef3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ export class MarkdownComponent implements OnInit {
@Input()
public renderUrlToTextFeature?: boolean = true;

constructor(private router: Router, private renderer: Renderer2) {}
constructor(private router: Router, private renderer: Renderer2) { }

public ngOnInit(): void {
this.content = this.content.replace(/ \n/g, '<br>');
this.content = this.content.replace(/(?:\s,|<br>,)/g, '');
if (this.renderUrlToTextFeature) {
this.renderUrlToText();
}
Expand All @@ -32,7 +33,7 @@ export class MarkdownComponent implements OnInit {
return true;
}

private renderUrlToText() : void {
private renderUrlToText(): void {
const renderer = new marked.Renderer();

renderer.link = (href, title, text) => {
Expand Down

0 comments on commit 79d0ef3

Please sign in to comment.