How to use the @microsoft/tsdoc.DocNodeTransforms.trimSpacesInParagraph function in @microsoft/tsdoc

To help you get started, we’ve selected a few @microsoft/tsdoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / rushstack / apps / api-extractor / src / aedoc / ApiDocumentation.ts View on Github external
case 'heading1':
            case 'heading2':
            case 'note-box':
            case 'page':
            case 'paragraph':
            case 'table':
              // Don't put a Markup.PARAGRAPH after a structural element,
              // since it is implicit.
              break;
            default:
              result.push(Markup.PARAGRAPH);
              break;
          }
        }
        const docParagraph: DocParagraph = node as DocParagraph;
        for (const childNode of DocNodeTransforms.trimSpacesInParagraph(docParagraph).nodes) {
          this._renderAsMarkupElementsInto(result, childNode, sectionName, allowStructuredContent);
        }
        break;
      case DocNodeKind.PlainText:
        const docPlainText: DocPlainText = node as DocPlainText;
        Markup.appendTextElements(result, docPlainText.text);
        break;
      case DocNodeKind.SoftBreak:
        Markup.appendTextElements(result, ' ');
        break;
      default:
        this.reportError('Unsupported TSDoc element: ' + node.kind);
    }
  }
github microsoft / rushstack / apps / api-documenter / src / markdown / MarkdownEmitter.ts View on Github external
break;
      }
      case DocNodeKind.LinkTag: {
        const docLinkTag: DocLinkTag = docNode as DocLinkTag;
        if (docLinkTag.codeDestination) {
          this.writeLinkTagWithCodeDestination(docLinkTag, context);
        } else if (docLinkTag.urlDestination) {
          this.writeLinkTagWithUrlDestination(docLinkTag, context);
        } else if (docLinkTag.linkText) {
          this.writePlainText(docLinkTag.linkText, context);
        }
        break;
      }
      case DocNodeKind.Paragraph: {
        const docParagraph: DocParagraph = docNode as DocParagraph;
        const trimmedParagraph: DocParagraph = DocNodeTransforms.trimSpacesInParagraph(docParagraph);
        if (context.insideTable) {
          if (docNodeSiblings) {
            writer.write('<p>');
            this.writeNodes(trimmedParagraph.nodes, context);
            writer.write('</p>');
          } else {
            // Special case:  If we are the only element inside this table cell, then we can omit the <p></p> container.
            this.writeNodes(trimmedParagraph.nodes, context);
          }
        } else {
          this.writeNodes(trimmedParagraph.nodes, context);
          writer.ensureNewLine();
          writer.writeLine();
        }
        break;
      }
github OfficeDev / office-ui-fabric-react / packages / api-docs / src / PageJsonGenerator.tsx View on Github external
function extractText(node: DocNode): string {
  switch (node.kind) {
    case 'Paragraph':
      const transformedParagraph: DocParagraph = DocNodeTransforms.trimSpacesInParagraph(node as DocParagraph);
      return renderDefaultValue(transformedParagraph);
    case 'CodeSpan':
    case 'PlainText':
      return (node as DocPlainText).text;
    case 'SoftBreak':
      return ' ';
    default:
      return '';
  }
}