Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zhgchgli0718 authored Mar 27, 2024
1 parent 77360a7 commit 62ea6a7
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,29 +268,6 @@ To extend the tag name and customize its style, you can use the ExtendTagName cl
let parser = ZHTMLParserBuilder.initWithDefault().add(ExtendTagName("zhgchgli"), withCustomStyle: MarkupStyle(backgroundColor: MarkupStyleColor(name: .aquamarine))).build()
```

#### Paragraph Spacing Policy

Often, you will want to create some type of spacing between various paragraphs or elements to increase legibility. There are two strategies to handle this:

1. Create additional line breaks in between paragraphs and sections. This means that there will be the size of 1 empty paragraph between each other paragraph. This is the default behaviour. In this mode you will likely want to ensure you are ***Not*** using paragraph spacing in in your markup styles.
2. Make use of `paragraphSpacing` through `MarkupStyleParagraphStyle` or `NSParagraphStyle`. If you are using these you will likely want to disable the additional line breaks.

This can be configured on your your `ZHTMLParserBuilder` as follows:

```swift
let parser = ZHTMLParserBuilder
.initWithDefault()
// Indicate that we should use paragraph spacing for spacing.
.set(spacingPolicy: .paragraphSpacing)
// Create our spacing using paragraphSpacing.
.set(rootStyle: .init(
paragraphStyle: .init(
paragraphSpacing: 12
)
))
.build()
```

### Render HTML String
```swift
parser.render(htmlString) // NSAttributedString
Expand Down

0 comments on commit 62ea6a7

Please sign in to comment.