diff --git a/Changelog.md b/Changelog.md index ea03baf1..dec97a84 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +## 1.5.3 +- support file links with exclamation mark and aliases (issue #55) +- support image resizing (issue #54) +- fixed $refName missing php variable (PR #56) + + ## 1.5.2 - fixed $closing variable error - set focus to search field diff --git a/perlite/Demo/README.md b/perlite/Demo/README.md index 17f7be8f..068fc1b2 100644 --- a/perlite/Demo/README.md +++ b/perlite/Demo/README.md @@ -32,12 +32,19 @@ If you want to discuss about Perlite you can join the thread in the [Obsidian Fo ## Demo Files + [[Demo Documents/markdown-sample]] [[Demo Documents/markdown-sample2]] [[Demo Documents/markdown-sample3|Call outs]] +[[Demo Documents/pdf-test.pdf|PDF Alias]] + +## Images + +![[test_img.png|200x200]] + ## Documentation on Github [Perlite on Github](https://github.com/secure-77/Perlite/) diff --git a/perlite/Demo/test_img.png b/perlite/Demo/test_img.png new file mode 100644 index 00000000..9a9a8944 Binary files /dev/null and b/perlite/Demo/test_img.png differ diff --git a/perlite/PerliteParsedown.php b/perlite/PerliteParsedown.php index 688210d8..4d652c98 100644 --- a/perlite/PerliteParsedown.php +++ b/perlite/PerliteParsedown.php @@ -1,7 +1,7 @@ \\2'; - $pattern = array('/(\!\[\[)(.*?.pdf)(\]\])/'); + + // pdf links with Alias + $replaces = '\\3'; + $pattern = array('/(\!?\[\[)(.*?.pdf)\|(.*)(\]\])/'); $content = preg_replace($pattern, $replaces ,$content); + // pdf links without Alias + $replaces = '\\2'; + $pattern = array('/(\!?\[\[)(.*?.pdf)(\]\])/'); + $content = preg_replace($pattern, $replaces ,$content); + // img links - $replaces = '
'; - $pattern = array('/(\!\[\[)(.*?)(.png|.jpg|.jpeg|.gif|.bmp|.tif|.tiff)(\]\])/'); + $replaces = ''; + $pattern = array('/(\!?\[\[)(.*?)(.png|.jpg|.jpeg|.gif|.bmp|.tif|.tiff)\|?(\d*)x?(\d*)(\]\])/'); $content = preg_replace($pattern, $replaces ,$content); // handle internal site links @@ -163,6 +169,7 @@ function($matches) use ($path, $sameFolder) { # split by # to keep the reference $splitLink = explode("#", $urlPath); + $refName = ''; if (count($splitLink) > 1) { $urlPath = $splitLink[0]; diff --git a/perlite/helper.php b/perlite/helper.php index b2172a01..271cb5b6 100644 --- a/perlite/helper.php +++ b/perlite/helper.php @@ -1,7 +1,7 @@