From 8b26efb2e4aae9837e1ce419d64923f72eae4abb Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 11 Jun 2024 16:00:35 +0100 Subject: Update README.md to match java-mammoth --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 41ae22f..096772d 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,10 @@ Methods: such as those used by bookmarks, footnotes and endnotes. Defaults to the empty string. +* `DocumentConverter ImageConverter(Func> imageConverter)`: + by default, images are converted to `` elements with the source included inline in the `src` attribute. + Call this to change how images are converted. + #### `IResult` 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 `` 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`: ``` -- cgit v1.2.3