Page 1 of 1

Markdown URL

Posted: Fri Apr 30, 2021 8:50 pm
by pyoung@wddc.com
Using LoadMarkdown to load an .md file.

Linked images are not working.

If turn on dloBasePathLinks, I get an error as it appear to be appending the base path to the URL.
If I disable dloBasePathLinks, I do not get an error but I only see little red squares.

If the file is opened in a markdown editor like Texts! the images appear correctly.

What am I doing wrong?

Thanks

Re: Markdown URL

Posted: Mon May 03, 2021 7:44 am
by Sergey Tkachenko
Are images on remote URLs?

By default, the components load images only from local files.
If you need to download images, you should do it in OnImportPicture event. It is called not only for Markdown import, but for import from all formats that may contain external images.

For example, you can use Indy's TidHttp to download from HTTP and HTTPS locations.

If you use RichViewActions, you do not need to write any code.
Place idHTTP1: TIdHTTP and RVAIndyDownloadInterface1: TRVAIndyDownloadInterface on a form, assign
RVAIndyDownloadInterface1.IdHTTP = idHTTP1.
RVAControlPanel1.DownloadInterface = RVAIndyDownloadInterface1.
To support HTTPS protocol, place IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL component on the form, assign it to idHTTP1.IOHandler property (probably, you also need to change IdSSLIOHandlerSocketOpenSSL1.SSLOptions.SSLVersions, because by default it includes only sslvTLSv1, but servers may use newer protocol versions).

Alternatively, you can use TclHTTP and TRVAClDownloadInterface components (from CleverComponents).

If you do not use RichViewActions, you can call IdHttp1.Get to download image, then RVGraphicHandler.LoadFromStream to load it (RVGraphicHandler is a global singleton class from RVGrHandler unit).

Re: Markdown URL

Posted: Tue May 04, 2021 6:09 pm
by pyoung@wddc.com
Great, thanks, will give that a try.