Skip to content

Commit

Permalink
Simplify and document md converter
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Dec 26, 2024
1 parent 180be4f commit 4690b1d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/api-docs/gen-components-docs/markdown/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ import json2md from 'json2md';
*/
import { generateMarkdownPropsJson } from './props.mjs';

/**
* Converter for strings that are already formatted as Markdown.
*
* @param {string} [input]
* @return {string} The trimmed input if it is contentful, otherwise an empty string.
*/
json2md.converters.md = ( input ) => {
return input?.trim() ? input : '';
return input?.trim() || '';
};

export function generateMarkdownDocs( { typeDocs, subcomponentTypeDocs } ) {
Expand Down

0 comments on commit 4690b1d

Please sign in to comment.