jfcere / ngx-markdown

Angular markdown component/directive/pipe/service to parse static, dynamic or remote content to HTML with syntax highlight and more...
https://jfcere.github.io/ngx-markdown
MIT License
1.07k stars 182 forks source link

Problems formatting the markdown #189

Closed FelipeSanchezCalzada closed 5 years ago

FelipeSanchezCalzada commented 5 years ago

I have the following text in markdown:

image

By entering it in the markdown tag as follows:

                    <markdown ngPreserveWhitespaces lineHighlight >
                        {{mdpost.markdown_text}}
                    </markdown>

The format is completely broken as seen in the following image. I only use bootstrap styles. image

jfcere commented 5 years ago

Hi @FelipeSanchezCalzada,

In your example you added lineHighlight attribute to the markdown component but this is used to emphasis specific lines as show in the demo here: http://jfcere.github.io/ngx-markdown/#line-highlight

I've create a StackBlitz with your example and it works fine once removing lineHighlight: https://stackblitz.com/edit/ngx-markdown-issue-189

Basically, you only need to use either one of the following examples...

<!-- using transclusion -->
<markdown ngPreserveWhitespaces>
  {{mdpost.markdown_text}}
</markdown>

<!-- using `data` input property -->
<markdown [data]="mdpost.markdown_text"></markdown>

Of course, for syntax highlight, be sure to provide the Prism files (both js and css) following the README.md instructions here: https://github.com/jfcere/ngx-markdown#syntax-highlight

FelipeSanchezCalzada commented 5 years ago

That was exactly the problem! Thank you!