From bba52b3700b238b10a61f185686da18c37b7bfd6 Mon Sep 17 00:00:00 2001 From: Chris van Mook Date: Thu, 1 Aug 2019 16:05:48 +0200 Subject: [PATCH] Update README.md Added: code example for propFilter option to prevent printing out all the HTML attributes --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index e52f8ca0..a166e9a9 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,19 @@ propsParser: require('react-docgen-typescript').withCustomConfig('./tsconfig.jso (props: PropItem, component: Component) => boolean ``` + In case you do not want to print out all the HTML props, because your component is typed like this: + ```typescript + const MyComponent: React.FC> = ()... + ``` + you can use this workaround inside `propFilter`: + ```typescript + if (prop.parent) { + return !prop.parent.fileName.includes('node_modules') + } + + return true + ``` + Note: `children` without a doc comment will not be documented. - componentNameResolver: