2021-05-02 15:02:06 +00:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Markdig.Syntax.Inlines ;
2021-06-10 02:38:48 +00:00
using osu.Game.Graphics.Containers.Markdown ;
2021-05-02 15:02:06 +00:00
namespace osu.Game.Overlays.Wiki.Markdown
{
2021-06-10 02:38:48 +00:00
public class WikiMarkdownImage : OsuMarkdownImage
2021-05-02 15:02:06 +00:00
{
public WikiMarkdownImage ( LinkInline linkInline )
2021-06-10 02:38:48 +00:00
: base ( linkInline )
2021-05-02 15:02:06 +00:00
{
}
2021-05-26 08:10:09 +00:00
protected override ImageContainer CreateImageContainer ( string url )
2021-05-02 15:02:06 +00:00
{
2021-05-26 08:10:09 +00:00
// The idea is replace "https://website.url/wiki/{path-to-image}" to "https://website.url/wiki/images/{path-to-image}"
2021-05-02 15:02:06 +00:00
// "/wiki/images/*" is route to fetch wiki image from osu!web server (see: https://github.com/ppy/osu-web/blob/4205eb66a4da86bdee7835045e4bf28c35456e04/routes/web.php#L289)
2021-05-26 08:10:09 +00:00
url = url . Replace ( "/wiki/" , "/wiki/images/" ) ;
2021-05-02 15:02:06 +00:00
2021-05-26 08:10:09 +00:00
return base . CreateImageContainer ( url ) ;
2021-05-02 15:02:06 +00:00
}
}
}