Skip to content

Commit

Permalink
[src/md_proccessor, README] Added keyword for to allow autoscaling of…
Browse files Browse the repository at this point in the history
… image along one dimension as mentioned in [Issue #14](#14). Updated README to include documentation for feature.
  • Loading branch information
bicarlsen committed Apr 3, 2022
1 parent ce5ebef commit f52718e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ e.g.


**Resizing**
When resizing internally embedded images one can normally use the `<width>x<height>` after the pipe (`|`) character.
When resizing internally embedded images one can normally use the `<width>x<height>` after the pipe (`|`) character. Use the keyword `auto` as `<width>` or `height` to set the size of one dimension and auto-scale the other.

e.g.

```markdown
![[my_amazing_image.png|50x50]]
![[my_long_photo|autox200]]
```

You can now resize both internally and externally embeded images with caption. However, delimeters must be used to distinguis the caption text if it is present.
Expand Down Expand Up @@ -71,7 +72,7 @@ A delimeter is a set of characters that identify the caption text to use. The de
+ **Note:** Only the first and last delimeters are matched, so the delimeter character can be used in the caption without special consideration, such as escaping.

+ **Caption as HTML:** Allows your captions to be rendered as HTML.<br/>
By turning this option on your captions will be inserted into the document as HTML, rather than text.
By turning this option on your captions will be inserted into the document as HTML rather than text.

## FAQ

Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "obsidian-image-caption",
"name": "Image Caption",
"version": "0.0.12",
"minAppVersion": "0.13.23",
"version": "0.0.13",
"minAppVersion": "0.14.2",
"description": "Add captions to images.",
"author": "Brian Carlsen",
"authorUrl": "https://github.com/bicarlsen",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-image-caption",
"version": "0.0.12",
"version": "0.0.13",
"description": "Add captions to images in Obsidian.",
"main": "main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/md_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function parseSize( text: string ) {
return undefined;
}

const size_pattern = /(\d+)x(\d+)/i;
const size_pattern = /(\d+|auto)x(\d+|auto)/i;
const match = text.match( size_pattern );
if ( ! match ) {
return undefined;
Expand Down
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"0.0.13": "0.14.2",
"0.0.12": "0.13.23",
"0.0.11": "0.13.19",
"0.0.10": "0.13.19",
Expand Down

0 comments on commit f52718e

Please sign in to comment.