From e09b1f797d646e240e405831a9ddccd21ca4b3f9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 20 Nov 2016 12:15:39 +0000 Subject: Add getDescendants and getDescendantsOfType to tranforms --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 491f687..0a6add2 100644 --- a/README.md +++ b/README.md @@ -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. -- cgit v1.2.3