71 Commits

Author SHA1 Message Date
Guille Gonzalez
5f61335814 Replace embedded cmark-gfm by swift-cmark (#348) 2024-10-11 08:58:59 +02:00
Shai Mishali
55441810c0 Allow customizing soft break mode (#342)
* Allow customizing soft break mode

Resolved #341

* Attributed renderer

* Tests

* Update snapshots
2024-08-12 11:06:38 +02:00
Guille Gonzalez
9a8119b37e Fix custom font dynamic size (#330)
* Calling `fixedSize` constructor for dynamic type

* Fix tests

---------

Co-authored-by: Mike Lewis <ml@anthropic.com>
2024-06-16 10:48:02 +02:00
Guille Gonzalez
ae799d015a Add support for Mac Catalyst (#287) 2023-12-31 17:11:36 +01:00
Guille Gonzalez
5be879a636 Use assertSnapshot(of:as:) (#286) 2023-12-31 15:57:00 +01:00
kirk
4ffe814e8d swiftui-snapshot-testing deprecation: use assertSnapshot(of:…) (#284) 2023-12-31 15:43:28 +01:00
Guille Gonzalez
ffb2d80d37 Move fixedSize modifier to themes (#222) 2023-04-15 12:37:38 +02:00
Guille Gonzalez
3830c4c77b Render HTML line breaks (#221) 2023-04-15 10:46:33 +02:00
Guille Gonzalez
c51f1a1b11 Add Markdown content to block configuration (#220)
* Add methods to access child content and render plain text

* Add the Markdown content to the block configuration

* Fix building with Swift 5.8

* Deprecate block-style methods with a label closure

* Fix deprecation warnings

* Update documentation
2023-04-11 11:47:39 +02:00
Guille Gonzalez
71c424069f Refactor Markdown parsing and implement the renderMarkdown() method. (#210) 2023-04-05 21:14:41 +02:00
Guille Gonzalez
d4d899384e Render first level inline images (#193)
* Render inline images

* Update demo project with inline images

* Update documentation
2023-02-26 19:20:16 +01:00
gonzalezreal
fdc444dba7 Run swift format 2023-02-24 16:04:18 +00:00
Guille Gonzalez
b720d975d7 Be explicit about keypath type to silence Xcode 14.3 error 2023-02-24 16:54:14 +01:00
Guille Gonzalez
a9c8888539 Enable dark-mode-only and light-mode-only images (#182) 2023-01-22 16:57:06 +01:00
Guille Gonzalez
a538390f18 Documentation (#178)
* WIP

* WIP

* WIP

* Disambiguate size-related View methods

* Update demo

* WIP

* Rename `Size` to `RelativeSize`

* WIP

* WIP

* WIP

* WIP

Fix relative URLs and heading anchor navigation

* WIP

* WIP
2023-01-22 08:01:59 +01:00
Guille Gonzalez
c203e1e918 Fix relative URLs and heading anchor navigation 2023-01-19 21:47:23 +01:00
Guille Gonzalez
2880bbc466 Rename BlockSpacing to BlockMargins (#177) 2022-12-30 19:13:45 +01:00
Guille Gonzalez
b704cbb48e Improve theme API (#176)
* Text styles

* Heading styles

* More block styles

* List marker styles

* Table and thematic break styles

* Adopt refactored styles

* Code cleanup

* Update sample code

* Rename TextStyle protocol

* Update sample code

* Disable font properties test in tvOS
2022-12-30 18:03:04 +01:00
Guille Gonzalez
15eb3add92 Add ImageProvider API (#175)
* Add ImageProvider API

* Add images sample code

* Add image providers demo
2022-12-25 08:02:54 +01:00
Guille Gonzalez
285f4fa027 Sample code (#170)
* Prevent some tests from running on iOS <16

* Add Swift Package Index manifest for documentation hosting

* Add a new demo project

* Add demo contents

* Remove commented code

* Set the GitHub theme as the default
2022-12-19 21:20:53 +01:00
Guille Gonzalez
5013266b4e Add watchOS support (#169)
* Update basic theme code block style

* Add watchOS support
2022-12-16 17:25:22 +01:00
Guille Gonzalez
c91729dd98 Themes (#168)
* Add dynamic color extension

* Add a basic theme

* Add DocC theme

* Fix block spacing logic

* Update theme initializer

* Add DocC theme tests

* Add GitHub theme
2022-12-12 21:05:32 +01:00
Guille Gonzalez
49101f6861 Add FontStyle and Size (#166)
* Add FontStyle and Size

* Polish FontStyle public API
2022-12-09 17:24:38 +01:00
Guille Gonzalez
07656f4b22 Render tables (#163)
* Parse tables

* Render tables

* Fix markdown content table test availability

* Add table border style to theme

* Add image flow spacing to theme

* Add table rendering tests

* Tweak perceptual precision in the markdown table snapshot tests
2022-11-27 17:28:14 +01:00
Guille Gonzalez
f704ff78d5 Render HTML blocks as verbatim text (#160) 2022-11-07 09:22:35 +01:00
Guille Gonzalez
d61b362c3c Render code blocks (#158)
* Parse code blocks

* Render code blocks
2022-11-04 19:02:20 +01:00
Guille Gonzalez
a5042d3d1d Render thematic breaks (#156)
* Parse thematic breaks

* Render thematic breaks
2022-11-03 16:51:43 +01:00
Guille Gonzalez
73a42536cd Space blocks by using the maximum between the top spacing of the block and the bottom spacing of its predecessor (#155) 2022-11-03 16:09:33 +01:00
Guille Gonzalez
90cfcbd256 Theme and styles refactoring (#154)
* Scale spacing preference relative to body

* Scale spacing before preference relative to body

* Make spacing and spacingBefore preferences optional

* Refactor image, blockquote, paragraph and heading styles into a single type

* Refactor list marker styles

* Remove TaskListItemStyle

* Refactor spaced sequence into its own view type

* Rename default block style and code inline style

* Refactor some block views into ApplyBlockStyle view
2022-11-01 21:13:02 +01:00
Guille Gonzalez
fe6c8f84f2 Render headings (#153)
* Parse headings

* Rename BlockSpacingModifier/Preference to BottomPadingModifier/Preference

* Add TopPaddingModifier/Preference

* Render headings

* Add a single font heading style
2022-10-30 20:13:08 +01:00
Guille Gonzalez
aa214580b0 Render blockquote (#151)
* Parse blockquote

* Render blockquote
2022-10-29 12:18:54 +02:00
Guille Gonzalez
df43833793 Result builders (#149)
* Implement an inline content builder

* Implement the markdown content builder

* Implement list content builder

* Make inline and block types internal
2022-10-27 17:36:47 +02:00
Guille Gonzalez
4239d1bf02 Render lists (#148)
* Parse list nodes

* Render numbered lists

* Render bulleted lists

* Render task lists
2022-10-26 18:26:03 +02:00
Guille Gonzalez
6396fc743f Render images (#147)
* Enable code coverage

* Implement image loading

* Render single-image paragraphs

* Update workflows

* Render paragraphs with multiple images and no text

* Run swift format

* Test image links in multi-image paragraphs
2022-10-24 10:05:48 +02:00
Guille Gonzalez
80737373fc Render paragraphs (#146)
* Render paragraphs

* Update CI workflow
2022-10-16 11:36:30 +02:00
Guille Gonzalez
4c32d4c216 Blank slate (#120) 2022-10-15 12:17:43 +02:00
Guille Gonzalez
6a33c60ad4 Fix rendering thematic break with centered or right aligned text (#114) 2022-07-22 18:27:35 +02:00
Guille Gonzalez
a42676a938 Fix crash when rendering a code block without a closing fence (#112) 2022-07-22 17:41:30 +02:00
Guille Gonzalez
4c16430033 Use the environment's line spacing (#95)
* Set the environment's line spacing value to the attributed string paragraph style

* Refactor renderer environment
2022-02-26 18:41:15 +01:00
Guille Gonzalez
b6e88f1083 Resolve fonts considering the environment's size category (#94)
* Resolve fonts considering the environment's size category

* Fix generation of README images
2022-02-26 17:21:35 +01:00
Guille Gonzalez
3c6b679af5 Remove MarkdownStyle.Color (#93) 2022-02-26 12:50:10 +01:00
Guille Gonzalez
86d7043949 Automates the generation of images used in the README 2022-01-16 15:49:27 +01:00
Guille Gonzalez
5e856b1e8a Fix code blocks sample in README 2022-01-16 15:49:27 +01:00
Guille Gonzalez
d99bb0a894 Update README 2022-01-16 15:49:27 +01:00
Guille Gonzalez
09d90ce7b6 Update snapshot images to iOS 15.2 / Xcode 13.2.1 2022-01-16 15:49:27 +01:00
Guille Gonzalez
38d61849b5 Refactor Color and make it hashable 2022-01-16 15:49:27 +01:00
Guille Gonzalez
e90803d879 Remove precision from snapshot tests to make them faster 2022-01-16 15:49:27 +01:00
Guille Gonzalez
ec353b5f7b Make Font hashable 2022-01-16 15:49:27 +01:00
Guille Gonzalez
9e8955a26d Add styling test 2022-01-16 15:49:27 +01:00
Guille Gonzalez
5955607433 Fix symbolic traits modifier 2022-01-16 15:49:27 +01:00