diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-06-11 16:00:35 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-06-11 16:00:35 +0100 |
| commit | 8b26efb2e4aae9837e1ce419d64923f72eae4abb (patch) | |
| tree | a0848e3bcacc89c487afe85d8273c323d6c9af34 | |
| parent | 6ba2ec47bc97889bf2a2bfff4094af48cecda2d9 (diff) | |
Update README.md to match java-mammoth
| -rw-r--r-- | README.md | 46 |
1 files changed, 42 insertions, 4 deletions
@@ -254,6 +254,10 @@ Methods: such as those used by bookmarks, footnotes and endnotes. Defaults to the empty string. +* `DocumentConverter ImageConverter(Func<IImage, IDictionary<string, string>> imageConverter)`: + by default, images are converted to `<img>` elements with the source included inline in the `src` attribute. + Call this to change how images are converted. + #### `IResult<T>` Represents the result of a conversion. Properties: @@ -271,9 +275,9 @@ and has the following members: * `Stream GetStream()`: open the image file. -* `String ContentType`: the content type of the image, such as `image/png`. +* `string ContentType`: the content type of the image, such as `image/png`. -* `String AltText`: the alt text of the image, if any. +* `string AltText`: the alt text of the image, if any, otherwise `null`. The function should return an `IDictionary` of attributes for the `<img>` element. At a minimum, this should include the `src` attribute. @@ -338,7 +342,7 @@ In this case, style mappings similar to `p[style-name='Aside Heading'] => div.as ### Document element matchers -#### Paragraphs and runs +#### Paragraphs, runs and tables Match any paragraph: @@ -352,7 +356,13 @@ Match any run: r ``` -To match a paragraph or run with a specific style, +Match any table: + +``` +table +``` + +To match a paragraph, run or table with a specific style, you can reference the style by name. This is the style name that is displayed in Microsoft Word or LibreOffice. For instance, to match a paragraph with the style name `Heading 1`: @@ -422,6 +432,28 @@ strike Note that this matches text that has had strikethrough explicitly applied to it. It will not match any text that is struckthrough because of its paragraph or run style. +#### All caps + +Match explicitly all caps text: + +``` +all-caps +``` + +Note that this matches text that has had all caps explicitly applied to it. +It will not match any text that is all caps because of its paragraph or run style. + +#### Small caps + +Match explicitly small caps text: + +``` +small-caps +``` + +Note that this matches text that has had small caps explicitly applied to it. +It will not match any text that is small caps because of its paragraph or run style. + #### Ignoring document elements Use `!` to ignore a document element. @@ -449,6 +481,12 @@ append a dot followed by the name of the class: h1.section-title ``` +To add an attribute, use square brackets similarly to a CSS attribute selector: + +``` +p[lang='fr'] +``` + To require that an element is fresh, use `:fresh`: ``` |
