Fixed remote URLs in markdown if using subfolder setup (also with inner twig)

This commit is contained in:
Matias Griese
2022-04-08 20:35:55 +03:00
parent ae3465646c
commit bd3b2baaa4
2 changed files with 10 additions and 2 deletions

View File

@@ -100,6 +100,10 @@ class Excerpts
if (Uri::isExternal($url) && !str_starts_with($url, $grav['base_url_absolute'])) {
return $excerpt;
}
if (str_starts_with($url, '/-') && str_ends_with($url, '-/')) {
// Twig in markdown
return $excerpt;
}
$url_parts = $this->parseUrl($url);
@@ -194,6 +198,10 @@ class Excerpts
if (Uri::isExternal($url) && !str_starts_with($url, $grav['base_url_absolute'])) {
return $excerpt;
}
if (str_starts_with($url, '/-') && str_ends_with($url, '-/')) {
// Twig in markdown
return $excerpt;
}
$url_parts = $this->parseUrl($url);

View File

@@ -940,8 +940,8 @@ class Page implements PageInterface
$content = $this->content;
if ($keepTwig) {
$token = [
'/' . Utils::generateRandomString(3),
Utils::generateRandomString(3) . '/'
'/-' . Utils::generateRandomString(3),
Utils::generateRandomString(3) . '-/'
];
// Base64 encode any twig.
$content = preg_replace_callback(