Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change return format of images with properties #36

Conversation

vasokot
Copy link
Contributor

@vasokot vasokot commented Nov 22, 2024

JetBrains change format for images with proprieties at YouTrack, so we need to add some changes at jira2markdown

@vasokot vasokot mentioned this pull request Nov 22, 2024
Copy link
Owner

@catcombo catcombo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good and well prepared! Thank you! I have only two additional suggestions.

  1. Please update images section in the README.md to reflect changes. Commit these changes with the following commit message docs(readme): use YouTrack format to render image with attributes.
  2. Change commit message for the code changes to feat(images): use YouTrack format to render image with attributes to follow https://www.conventionalcommits.org/en/v1.0.0/

@@ -23,7 +23,7 @@ jobs:

- name: Restore virtualenv from cache
id: cache
uses: actions/cache@v1
uses: actions/cache@v3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also bump other actions version?

  • actions/checkout@v2 -> actions/checkout@v4
  • actions/setup-python@v2 -> actions/setup-python@v5

Could you please move these changes to a separate commit with the following comment: chore(ci): bump actions version

@@ -32,7 +32,7 @@ def action(self, tokens: ParseResults) -> str:
if name in self.ALLOWED_ATTRS
)
if attrs_str:
return f'<img src="{tokens.url}" {attrs_str} />'
return f"![{tokens.url}]({tokens.url})" + "{" + attrs_str + "}"
Copy link
Owner

@catcombo catcombo Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attrs_str should not contain a value in quotes. I just tested image attributes in the YouTrack. The following image has been render with the correct image size:

![Markdown logo](https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/208px-Markdown-mark.svg.png "Markdown"){width=100}

But if attribute value surrounded with the quotes, image size doesn't change

![Markdown logo](https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/208px-Markdown-mark.svg.png "Markdown"){width="100"}

You can change this behavior by replacing f'{name}="{value}"' a few lines above with the f"{name}={value}". Related tests should be updated as well.

…h_properties' into feature/change_image_convert_with_properties

# Conflicts:
#	tests/markup/test_images.py
#	tests/markup/test_mixed_content.py
@vasokot vasokot closed this Nov 22, 2024
@vasokot
Copy link
Contributor Author

vasokot commented Nov 22, 2024

All changes applied at #37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants