Skip to content

Commit

Permalink
fix minor docs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Mar 16, 2022
1 parent 037a9c2 commit 10bebf1
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,22 @@ interface Config {
}
```

You would use this by passing a custom configuration object into the function in order to override any of the defaults above. For example, this is how you would create telescopic text with custom HTML tags:

```javascript
const content = `
* Some <b>rich</b> text
* with <i>nested</i> <b>rich</b> text
`
const config = { textMode: TextMode.Html };
const poemContent = createTelescopicTextFromBulletedList(content, config);
```

You can check out a more detailed example in `demo/index.html`

If you are using plain 'text' as the textMode, you can also define an object containing special characters and the rules for how to replace them.

```ts
```typescript
interface TextReplacements {
// Each entry is keyed by its regex string match
// It defines a function that takes in the current line of text as well as its parent node
Expand All @@ -121,22 +134,15 @@ interface TextReplacements {
By default, only these special characters have text replacements
- line breaks (`---`)
- bold (`*...*`)
- emphasis (`_...*`)
- emphasis (`_..._`)
To disable this, you can pass in an empty object for special characters:

You would use this by passing a custom configuration object into the function in order to override any of the defaults above. For example, this is how you would create telescopic text with custom HTML tags:
```javascript
const content = `
* Some <b>rich</b> text
* with <i>nested</i> <b>rich</b> text
`
const config = { textMode: TextMode.Html };
const poemContent = createTelescopicTextFromBulletedList(content, config);
```typescript
const poemContent = createTelescopicTextFromBulletedList(content, {
specialCharacters: {}
});
```

You can check out a more detailed example in `demo/index.html`



## Types
```typescript
// Default function to create a new `<div>` node containing the
Expand Down

0 comments on commit 10bebf1

Please sign in to comment.