From 5b1598b771d5850c9da265ee0d3eaa2b8bbbe75f Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 10 Feb 2022 07:38:22 -0800 Subject: [PATCH] Fix readme. --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bf9a5ec..1259f57 100644 --- a/README.md +++ b/README.md @@ -53,19 +53,22 @@ func unexclaim(_ node: Node) -> Node { case let .element(tag, attrs, children): // Recursively transform all of the children of an element - return .element(tag, attrs, children.map(unexclaim)) + return .element(tag, attrs, unexclaim(children)) case let .fragment(children): // Recursively transform all of the children of a fragment return .fragment(children.map(unexclaim)) - case let .raw(string), .text(string): + case let .raw(string): // Transform text nodes by replacing exclamation marks with periods. - return string.replacingOccurrences(of: "!", with: ".") + return .raw(string.replacingOccurrences(of: "!", with: ".")) + case let .text(string): + // Transform text nodes by replacing exclamation marks with periods. + return .text(string.replacingOccurrences(of: "!", with: ".")) } } -unexclaim(document) // Node +unexclaim(document) ``` Once your document is created you can render it using the `render` function: