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

Support for images and relative links in attributed string renderer. #49

Merged
merged 3 commits into from Sep 10, 2019

Conversation

jlj
Copy link
Contributor

@jlj jlj commented May 12, 2019

Hi,

I don't know if you are still maintaining this project, but if you are, you might be interested by this PR adding images and relative links to attributed string rendering on both iOS and macOS. Additionally I made a overall refresh to the project: cmark v0.29, Swift 4.2 example apps, paragraph attributes…
(see the commit message for all details).

jlj added 2 commits May 12, 2019 15:44
…Minor improvements.

- Markdown images are now rendered in attributed strings (as text attachments) on iOS and macOS.
- Image paragraph attributes can be specified by CMTextAttribute property `imageParagraphAttributes` (e.g. paragraph spacing, centering…).
- Paragraph attributes can be specified by CMTextAttribute property `paragraphAttributes` (was previously hardcoded).
- Added support for relative URIs in markdown link and images, i.e. for destination URIs that do not specify a URL scheme or host. The base URL for relative links or images can be defined via a new CMDocuments property `linksBaseURL` and is set by default as the document file's directory, so as to enable rendering of images in the document file's directory by simply specifying their filename like: `![Image Description](MyImage.png)`
- Upgraded cmark version to version0.29.
- Updated example apps to Swift 4.2.
- Added a markdown file selection button in the masOS example, with a `linksBaseURL`  textfield on the file selection panel. This allows to quickly check the rendering of markdown files in various contexts.
- Updated the default header attributes in CMTextAttribute to include paragraph-spacing for better default attributed string rendering.
- Fixed CocoaMarkdownTests for consistency with test file `test.md`.
@indragiek indragiek self-assigned this May 12, 2019
@indragiek
Copy link
Owner

Wow, this is great! Thanks for working on this — I'll try to review as soon as possible.

@tsfischer
Copy link

Any update on whether this is going to be merged in or not? We are looking at replacing our current Markdown library, and image functionality is crucial. Thanks!

@indragiek
Copy link
Owner

Sorry about the delay in getting to this, this looks great, merging!

@indragiek indragiek merged commit a827be4 into indragiek:master Sep 10, 2019
@indragiek indragiek mentioned this pull request Oct 20, 2019
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.

None yet

3 participants