question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Displaying a remote markdown with images

See original GitHub issue

While it works fine providing a markdown file hosted e.g. on github with the src attribute, relative paths do not work, since ngx-markdown uses the base url for resolving relative paths. Little demo , click on the Code of Conduct Link and it won’t work because it should link to https://github.com/Microsoft/vscode/CODE_OF_CONDUCT.md but is actually linked to https://run.plnkr.co/iPObnRnGowv03lXn/CODE_OF_CONDUCT.md

I think ngx-markdown should be abled to deal properly with relative links as they are handy and commonly used to link other resources and images without breaking across plattforms.

If this behavior should not be part of ngx-markdown, how could I make a workaround for it?

As this package is used marked.js , we can probably utilize the baseUrl Parameter here https://marked.js.org/#/USING_ADVANCED.md#options and set it to the src Path without the filename at the end.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
gaborgyarmaticommented, Dec 27, 2019

@jfcere This is my resolve thanks to @raspyweather

  imports: [
    BrowserModule,
    AppRoutingModule,
    MarkdownModule.forRoot({
      loader: HttpClient,
      markedOptions: {
        provide: MarkedOptions,
        useValue: {
          baseUrl: ' URL HERE '
        }
      }
    }),
1reaction
raspyweathercommented, Jan 5, 2020

Awesome job! Works great for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Images into Markdown Documents and Weblog Posts ...
The most visible way to embed images into your Markdown is to use the Toolbar Image icon (or Alt-I) to bring up the...
Read more >
How to display images in Markdown files on Github?
I found the answer myself. Just simply append ?raw=true to the image url will make the trick: ![](images/table 1-1.png?raw=true).
Read more >
Markdown to insert and display an image on GitHub repo
I like to test my Markdown locally before pushing somewhere viewable only through a URL. So I want a relative URL ...
Read more >
Embedding Images - Markdown Monster Documentation
Markdown Monster includes a File and Folder Browser that lets you browse files including images. You can click on the image to preview...
Read more >
How To Add Images in Markdown - DigitalOcean
Introduction. You can add images to Markdown using the [alt text](image_url) syntax. Let's see how it works.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found