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

Automatically re-render markdown when renderer settings change #122

Closed
joeskeen opened this issue Dec 3, 2018 · 2 comments
Closed

Automatically re-render markdown when renderer settings change #122

joeskeen opened this issue Dec 3, 2018 · 2 comments
Labels
enhancement Improvement request

Comments

@joeskeen
Copy link

joeskeen commented Dec 3, 2018

We have a use-case where we would like to have a user-defined setting that affects the markdown rendering. I was able to use the MarkdownService.renderer to change the behavior of rendering certain elements when those settings change; however, the markdown does not re-render until the source markdown changes. My workaround was to append the markdown with a zero-width space character, then use a setTimeout to remove it. It would be nicer, though, if when I make changes to the renderer, that it would re-render automatically.

Example StackBlitz: https://stackblitz.com/edit/ngx-markdown-g2deyn?file=src%2Fapp%2Fapp.component.ts

@jfcere jfcere added the enhancement Improvement request label Jan 13, 2019
@muuvmuuv
Copy link

I have used ChangeDetectorRef to run after I have made changes to my markdown string. Maybe it helps.

constructor(private cdr: ChangeDetectorRef) {}

ngOnInit() {
  // something
  this.cdr.detectChanges()
}

@jfcere
Copy link
Owner

jfcere commented Jun 10, 2022

A reload method has been added to the MarkdownService allowing to re-render all MarkdownComponent programmatically.

This will be released as part of ngx-markdown v14 which should be released next week alongside the update to Angular 14.

@jfcere jfcere closed this as completed Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants