diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-11-20 12:15:39 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-11-20 12:16:49 +0000 |
| commit | e09b1f797d646e240e405831a9ddccd21ca4b3f9 (patch) | |
| tree | 4f5fd0a872457d5aab7c6882e43485ac076d9d6e /README.md | |
| parent | f4a6e9f3077e009ce36d03ff9fb704dc8bcff31b (diff) | |
Add getDescendants and getDescendantsOfType to tranforms
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -544,6 +544,19 @@ Returns a function that can be used as the `transformDocument` option. This will apply the function `transformParagraph` to each paragraph element. `transformParagraph` should return the new paragraph. +#### `mammoth.transforms.getDescendants(element)` + +Gets all descendants of an element. + +#### `mammoth.transforms.getDescendantsOfType(element, type)` + +Gets all descendants of a particular type of an element. +For instance, to get all runs within an element `paragraph`: + +```javascript +var runs = mammoth.transforms.getDescendantsOfType(paragraph, "run"); +``` + ## Writing style maps A style map is made up of a number of style mappings separated by new lines. |
