• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of dgeni packages for generating documentation from source code.

Dgeni Packages

This repository contains a collection of Dgeni Packages that can be used by the Dgeni documentation generator to create documentation from source code.

Out of the box there are the following packages:

  • base - The minimal set of processors to get started with Dgeni
  • git - Provides some git and version information
  • jsdoc - Tag parsing and extracting
  • nunjucks - The nunjucks template rendering engine. No longer in jsdoc - you must add this explicitly to your config or you will get Error: No provider for "templateEngine"! (Resolving: templateEngine)
  • ngdoc - The angular.js specific tag-defs, processors and templates. This loads the jsdoc and nunjucks packages for you.
  • examples - Processors to support the runnable examples feature in the angular.js docs site.
  • dgeni - Support for documenting Dgeni packages (incomplete)
  • typescript - Tag parsing and extracting for TypeScript modules.

base Package

Processors

  • computeIdsProcessor - Computes the id and aliases for documents using templates or helper functions, on a per docType basis.
  • computePathsProcessor - Computes the path and outputPath for documents using templates or helper functions, on a per docType basis.
  • debugDumpProcessor - dump the current state of the docs array to a file (disabled by default)
  • readFilesProcessor - used to load up documents from files. This processor can be configured to use a set of file readers. There are file readers in the jsdoc and ngdoc packages.
  • renderDocsProcessor - render the documents into a property (doc.renderedContent) using a templateEngine, which must be provided separately - see nunjucks package.
  • unescapeCommentsProcessor - unescape comment markers that would break the jsdoc comment style, e.g. */
  • writeFilesProcessor - write the docs that have an outputPath to disk

Services

  • aliasMap - A map of ids/aliases to docs. This is used for matching references to documents in links and relations such as modules and object members.
  • createDocMessage - a helper for creating nice messages about documents (useful in logging and errors)
  • encodeDocBlock - convert a block of code into HTML
  • templateFinder - search folders using patterns to find a template that matches a given document.
  • trimIndentation - "intelligently" trim whitespace indentation from the start of each line of a block of text.
  • writeFile - Write some contents to a file, ensuring the path to the file exists.

Template Finding

The template used to render a doc is computed by the templateFinder, which uses the first match from a set of patterns in a set of folders, provided in the configuration. This allows a lot of control to provide generic templates for most situations and specific templates for exceptional cases.

Here is an example of some standard template patterns:

templateFinder.templatePatterns = [
  '${ doc.template }',
  '${ doc.area }/${ doc.id }.${ doc.docType }.template.html',
  '${ doc.area }/${ doc.id }.template.html',
  '${ doc.area }/${ doc.docType }.template.html',
  '${ doc.id }.${ doc.docType }.template.html',
  '${ doc.id }.template.html',
  '${ doc.docType }.template.html'
]

git Package

This package provides some git and version information to the renderDocsPocessor that is available in the templates. This code as it is was made for the angular.js document generation, including some custom logic for special versions. However, any of the services can be overridden with custom behavior.

The git information is made available to templates via the extraData.git property. See the section below to see an example usage.

Services

  • decorateVersion - all semvers are passed through this function so that additional data can before added to them.
  • getPreviousVersions - pulls versions from git tags of the repository.
  • gitData - the additional information that is added to the extraData of renderDocsPocessor.
  • gitRepoInfo - the owner and repo of the local git repository.
  • packageInfo - the contents of the package.json.
  • versionInfo - aggregated version and git information.

Using extraData.git

An example as used in git/templates/api/api.template.html

<a href='https://github.com/{$ git.info.owner $}/{$ git.info.repo $}/tree/{$ git.version.isSnapshot and 'master' or git.version.raw $}/{$ doc.fileInfo.projectRelativePath $}#L{$ doc.startingLine $}' class='view-source pull-right btn btn-primary'>
  <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source
</a>

nunjucks Package

This package provides a nunjucks driven implementation of the templateEngine required by the base package renderDocsPocessor. The "nunjucks" JavaScript template tool-kit to generates HTML based on the data in each document. We have nunjucks templates, tags and filters that can render links and text as markdown and will highlight code.

Services

  • nunjucks-template-engine - provide a templateEngine that uses the Nunjucks template library to render the documents into text, such as HTML or JS, based on templates.

jsdoc Package

File Readers

  • jsdoc - can read documents from jsdoc style comments in source code files.

Processors

  • codeNameProcessor - infer the name of the document from the code following the document in the source file.
  • extractTagsProcessor - use a tagExtractor to extract information from the parsed tags.
  • inlineTagsProcessor - Search the docs for inline tags that need to have content injected
  • parseTagsProcessor - use a tagParser to parses the jsdoc tags in the document content.

Tag Definitions

The jsdoc package contains definitions for a number of standard jsdoc tags including: name, memberof, param, property, returns, module, description, usage, animations, constructor, class, classdesc, global, namespace, method, type, kind, access, public, private and protected.

Services (Tag Transformations)

This package provides a number of Transform services that are used in Tag Definitions to transform the value of the tag from the string in the tag description to something more meaningful in the doc.

  • extractAccessTransform - extract an access level (e.g. public, protected, private) from tags You can configure this transform to register access tags and set the property where access info is written.
    • extractAccessTransform.allowedTags.set('tagName', [propertValue]) - register a tag that can act as as an alias to set an access level. The propertyValue is optional and if not undefined will return this value from the transform that will be written to the property. (defaults to public:undefined, private:undefined, protected:undefined)
    • extractAccessTransformImpl.allowedDocTypes.set('docType') - register a docType that can contain access type tags (defaults to "property" and "method")
    • extractAccessTransformImpl.accessProperty - specify the property to which to write the access value (defaults to "access")
    • extractAccessTransformImpl.accessTagName - specify the name of the tag that can hold access values (defaults to "access")
  • extractNameTransform - extract a name from a tag
  • extractTypeTransform - extract a type from a tag
  • trimWhitespaceTransform - trim whitespace from before and after the tag value
  • unknownTagTransform - add an error to the tag if it is unknown
  • wholeTagTransform - Use the whole tag as the value rather than using a tag property
  • codeNameService - helper service for codeNameProcessor, registers code name matchers and performs actual matches against AST tree

Templates

This package does not provide any templates nor a templateEngine to render templates (use the nunjucks package to add this).

Tag Definitions

This package provides a minimal implementation of tags from the JSDoc project. They extract the name and type from the tag description accordingly but do not fully implement all the JSDoc tag functionality.

Code Name Matchers

Matcher performs a search for a suitable code name at the given jsdoc code point (AST node). codeNameService matches AST node name against matcher name and if suitable matcher is found, executes it.

Matcher name consists of <AstNodeName> and NodeMatcher substrings, i.e. FunctionExpressionNodeMatcher then latter is stripped and matcher is used by the former part, i.e. FunctionExpression.

Matcher should accept single argument - node and return either string with name or literal null.

Matchers:

  • ArrayExpression
  • ArrowFunctionExpression
  • AssignmentExpression
  • CallExpression
  • ClassDeclaration
  • ExportDefaultDeclaration
  • ExpressionStatement
  • FunctionDeclaration
  • FunctionExpression
  • Identifier
  • Literal
  • MemberExpression
  • MethodDefinition
  • NewExpression
  • ObjectExpression
  • Program
  • Property
  • ReturnStatement
  • ThrowStatement
  • VariableDeclaration
  • VariableDeclarator

ngdoc Package

The ngdoc Package depends upon the jsdoc and nunjucks packages. It provides additional support for non-API documents written in files with .ngdoc extension; it also computes additional properties specific to Angular related code.

File Readers

  • ngdoc - can pull a single document from an ngdoc content file.

Processors

  • filterNgdocsProcessor - For AngularJS we are only interested in documents that contain the @ngdoc tag. This processor removes docs that do not contain this tag.

  • generateComponentGroupsProcessor - Generate documents for each group of components (by type) within a module

  • memberDocsProcessor - This processor connects docs that are members (properties, methods and events) to their container docs, removing them from the main docs collection.

  • moduleDocsProcessor - This processor computes properties for module docs such as packageName and packageFileName; it adds modules to the moduleMap service and connects all the docs that are in a module to the module doc in the components property

  • providerDocsProcessor - This processor relates documents about angular services to their corresponding provider document.

Tag Definitions

This package modifies and adds new tag definitions on top of those provided by the jsdoc package: area, element, eventType, example, fullName, id, module, name, ngdoc, packageName, parent, priority, restrict, scope and title.

Inline Tag Definitions

  • link - Process inline link tags (of the form {@link some/uri Some Title}), replacing them with HTML anchors

Services

  • getAliases() - Get a list of all the aliases that can be made from the provided doc
  • getDocFromAliases() - Find a document from the aliasMap that matches the given alias
  • getLinkInfo() - Get link information to a document that matches the given url
  • getTypeClass() - Get a CSS class string for the given type string
  • moduleMap - A collection of modules keyed on the module id

Templates

This package provides a set of templates for generating an HTML file for each document: api, directive, error, filter function, input, module, object, overview, provider, service, type and a number to support rendering of the runnable examples.

You should be aware that because of the overlap in syntax between Nunjucks bindings and AngularJS bindings, the ngdoc package changes the default Nunjucks binding tags:

templateEngine.config.tags = {
  variableStart: '{$',
  variableEnd: '$}'
};

Rendering Filters

  • code - Render a span of text as code
  • link - Render a HTML anchor link
  • typeClass - Render a CSS class for a given type

Rendering Tags

  • code - Render a block of code

examples Package

This package is a mix-in that provides functionality for working with examples in the docs.

Inside your docs you can markup inline-examples such as:

Some text before the example

<example name="example-name">
  <file name="index.html">
    <div>The main HTML for the example</div>
  </file>
  <file name="app.js">
    // Some JavaScript code to be included in the example
  </file>
</example>

Some text after the example

Processors

  • generateExamplesProcessor - Add new docs to the docs collection for each example in the examples service that will be rendered as files that can be run in the browser, for example as live in-place demos of the examples or for e2e testing. This processor must be configured with a collection of deployments that tell it what versions of each example to generate. See the section of Deployment Configuration below.
  • parseExamplesProcessor - Parse the <example> tags from the content and add them to the examples service
  • generateProtractorTestsProcessor - Generate a protractor test files from the e2e tests in the examples. This processor must be configured with a collection of deployments that tell versions of the protractor tests to generate. See the section of Deployment Configuration below.

Deployment Configuration

The generateExamplesProcessor and generateProtractorTestsProcessor processors have a required property called deployments. This property should be an array of deployment information objects telling the processor what files to generate.

For instance you might have a "debug" deployment that loads angular.js into the example, and also a "default" deployment that loads angular.min.js into the example. Equally you might have deployments that use JQuery and some that only use Angular's jqLite.

You can configure this in your package like so:

.config(function(generateExamplesProcessor, generateProtractorTestsProcessor) {
  var deployments = [
    { name: 'debug', ... },
    { name: 'default', ... }
  ];

  generateExamplesProcessor.deployments = deployments;
  generateProtractorTestsProcessor.deployments = deployments;
});

A deployment can must have a name property and can also include an examples property that contains information about paths and extra files to inject into runtime examples. Further a protractor test is generated for each deployment and it uses the deployment name to find the path to the associated example for that deployment.

{
  name: 'default',
  examples: {
    commonFiles: {
      scripts: [ '../../../angular.js' ]
    },
    dependencyPath: '../../../'
  }
}

Here you can see we have a default deployment that injects the angular.js file into all examples, plus any dependencies referenced in the example itself are made relative to the given dependencyPath.

Inline Tag Definitions

  • runnableExample - Inject the specified runnable example into the doc

Services

  • exampleMap - a hash map holding each example by id, which is a unique id generated from the name of the example

post-process-html Package

This package provides a HTML post process manager powered by rehype. It uses the rehype processing engine to manipulate the renderedContent HTML via rehype "plugins" that work with HTML ASTs (HASTs). Read more https://github.com/wooorm/rehype

Processors

  • post-process-html - Use the rehype processing engine to manipulate the renderedContent HTML via rehype "plugins" that work with HTML ASTs (HASTs). Each plugin is a factory function that will be called with the "rehype" engine as this. The factory should return a transform function that takes a HAST and returns a boolean orundefined. The HAST can be mutated by the "transform" function. If false is returned then the processing stops with that plugin.

typescript Package

File Readers

  • at the moment we are not using a filereader but the readTypeScriptModules processor to read our modules.

Processors

  • readTypeScriptModules - parse the sourceFiles with the help of the tsParser service and return a doc for each exported member. You can either pass an array of strings or an array of objects with include and exclude globbing patterns. A mix of both is possible as well. The processor can be configured to export private members (marked as /** @internal */ as well as members starting with an underscore (_)) by setting the property hidePrivateMembers to false. Set sortClassMembers to true to sort instance and static members by name (defaults to order of appearence). You can ignore special exports by adding strings or regexes to the ignoreExportsMatching property (defaults to ___esModule.

Services

  • convertPrivateClassesToInterfaces - pass this service a list of exported docs and if it represents a class that is marked as /** @internal */ the doc will be converted to represent an interface.
  • tsParser - uses the typescript compiler and a host created by createCompilerHost to actually read and compile the source files. The docs are created from the symbols read by the typescript program.
  • createCompilerHost - creates a new compiler host which can, among other things, resolve file paths and check if files exist
  • getContent - retrieves the file contents and comments.

Templates

This package does not provide any templates nor a templateEngine to render templates (use the nunjucks package to add this).

Tag Definitions

Please note that at the moment the @param documentation is ignored.

More Repositories

1

angular

Deliver web apps with confidence πŸš€
TypeScript
96,000
star
2

angular.js

AngularJS - HTML enhanced for web apps!
JavaScript
59,091
star
3

angular-cli

CLI tool for Angular
TypeScript
26,756
star
4

components

Component infrastructure and Material Design components for Angular
TypeScript
24,333
star
5

material

Material design for AngularJS
JavaScript
16,637
star
6

angular-seed

Seed project for angular apps.
JavaScript
13,027
star
7

protractor

E2E test framework for Angular apps
JavaScript
8,780
star
8

angularfire

Angular + Firebase = ❀️
TypeScript
7,692
star
9

flex-layout

Provides HTML UI layout for Angular applications; using Flexbox and a Responsive API
TypeScript
5,904
star
10

universal

Server-side rendering and Prerendering for Angular
TypeScript
4,040
star
11

zone.js

Implements Zones for JavaScript
TypeScript
3,243
star
12

quickstart

Angular QuickStart - source from the documentation
JavaScript
3,128
star
13

angular-phonecat

Tutorial on building an angular application.
JavaScript
3,128
star
14

batarang

AngularJS WebInspector Extension for Chrome
JavaScript
2,444
star
15

material-start

Starter Repository for AngularJS Material
JavaScript
2,214
star
16

universal-starter

Angular Universal starter kit by @AngularClass
TypeScript
2,028
star
17

mobile-toolkit

Tools for building progressive web apps with Angular
JavaScript
1,344
star
18

in-memory-web-api

The code for this project has moved to the angular/angular repo. This repo is now archived.
TypeScript
1,172
star
19

angular.io

Website for the Angular project (see github.com/angular/angular for the project repo)
HTML
1,032
star
20

angular2-seed

TypeScript
1,011
star
21

tsickle

Tsickle β€” TypeScript to Closure Translator
TypeScript
893
star
22

material.angular.io

Docs site for Angular Components
TypeScript
889
star
23

di.js

Dependency Injection Framework for the future generations...
JavaScript
822
star
24

react-native-renderer

Use Angular and React Native to build applications for Android and iOS
TypeScript
789
star
25

vscode-ng-language-service

Angular extension for Visual Studio Code
TypeScript
777
star
26

dgeni

Flexible JavaScript documentation generator used by AngularJS, Protractor and other JS projects
TypeScript
770
star
27

angular-cn

Chinese localization of angular.io
Pug
761
star
28

router

The Angular 1 Component Router
JavaScript
667
star
29

angular-electron

Angular2 + Electron
TypeScript
610
star
30

devkit

549
star
31

bower-material

This repository is used for publishing the AngularJS Material v1.x library
JavaScript
506
star
32

watchtower.js

ES6 Port of Angular.dart change detection code.
JavaScript
410
star
33

preboot

Coordinate transfer of state from server to client view for isomorphic/universal JavaScript web applications
TypeScript
384
star
34

angular-hint

run-time hinting for AngularJS applications
JavaScript
368
star
35

angular-bazel-example

MOVED to the bazel nodejs monorepo πŸ‘‰
TypeScript
350
star
36

builtwith.angularjs.org

builtwith.angularjs.org
HTML
271
star
37

protractor-accessibility-plugin

Runs a set of accessibility audits
JavaScript
263
star
38

angularjs.org

code for angularjs.org site
JavaScript
260
star
39

angular-update-guide

An interactive guide to updating the version of Angular in your apps
TypeScript
251
star
40

webdriver-manager

A binary manager for E2E testing
TypeScript
225
star
41

bower-angular

Bower package for AngularJS
CSS
224
star
42

angular-ja

repository for Japanese localization of angular.io
TypeScript
212
star
43

ngSocket

WebSocket support for angular
JavaScript
204
star
44

peepcode-tunes

Peepcode's Backbone.js Music Player Reimplemented in AngularJS
JavaScript
204
star
45

clutz

Closure to TypeScript `.d.ts` generator
Java
163
star
46

benchpress

JavaScript
160
star
47

code.angularjs.org

code.angularjs.org
153
star
48

ngcc-validation

Angular Ivy library compatibility validation project
TypeScript
146
star
49

bower-angular-route

angular-route bower repo
JavaScript
143
star
50

atscript-playground

A repo to play with AtScript.
JavaScript
141
star
51

bower-angular-animate

Bower package for the AngularJS animation module
JavaScript
137
star
52

protractor-cookbook

Examples for using Protractor in various common scenarios.
TypeScript
130
star
53

diary.js

Flexible logging and profiling library for JavaScript
JavaScript
127
star
54

bower-angular-i18n

internationalization module for AngularJS
JavaScript
125
star
55

ts-minify

A tool to aid minification of Typescript code, using Typescript's type information.
TypeScript
119
star
56

closure-demo

TypeScript
114
star
57

ngMigration-Forum

109
star
58

watScript

The next generation JavaScript language that will kill ALL the frameworks!
101
star
59

material-adaptive

Adaptive template development with Angular Material
JavaScript
101
star
60

bower-angular-sanitize

angular-sanitize bower repo
JavaScript
99
star
61

code-of-conduct

A code of conduct for all Angular projects
99
star
62

clang-format

Node repackaging of the clang-format native binary
Python
97
star
63

tactical

Data access library for Angular
TypeScript
93
star
64

bower-angular-resource

angular-resource bower repo
JavaScript
92
star
65

dashboard.angularjs.org

AngularJS Dashboard
JavaScript
89
star
66

angular-jquery-ui

jQueryUI widgets wrapped as angular widgets
JavaScript
88
star
67

bower-angular-mocks

angular-mocks.js bower repo
JavaScript
87
star
68

bower-angular-cookies

angular-cookies bower repo
JavaScript
85
star
69

issue-zero

TypeScript
82
star
70

bower-angular-touch

JavaScript
79
star
71

templating

Templating engine for Angular 2.0
JavaScript
76
star
72

a

Library for annotating ES5
JavaScript
67
star
73

material-icons

Common resources for material design in AngularJS
66
star
74

vladivostok

TypeScript
65
star
75

dev-infra

Angular Development Infrastructure
JavaScript
65
star
76

bower-angular-messages

JavaScript
63
star
77

angular-component-spec

Specification for reusable AngularJS components
61
star
78

ci.angularjs.org

ci.angularjs.org CI server scripts
Shell
60
star
79

projects

github reference application for Angular 2.0
JavaScript
58
star
80

codelabs

55
star
81

code.material.angularjs.org

Documentation site for AngularJS Material
HTML
50
star
82

material-tools

Tools for AngularJS Material
TypeScript
47
star
83

jasminewd

Adapter for Jasmine-to-WebDriverJS
JavaScript
46
star
84

material-update-tool

Standalone update tool for updating Angular CDK and Material
TypeScript
46
star
85

material-builds

Build snapshots for @angular/material
JavaScript
45
star
86

material2-docs-content

Docs content for @angular/material
HTML
39
star
87

cdk-builds

Angular CDK builds
JavaScript
38
star
88

benchpress-tree

A reference implementation of a benchpress deep-tree benchmark as seen in Angular
JavaScript
37
star
89

router-builds

@angular/router build artifacts
JavaScript
36
star
90

angular-ko

HTML
36
star
91

prophecy

Deferred/Promise for AngularJS 2.0
JavaScript
36
star
92

answers-app

TypeScript
36
star
93

assert

A runtime type assertion library.
JavaScript
35
star
94

ngo

TypeScript
34
star
95

protractor-console-plugin

Checks the browser log after each test for warnings and errors
JavaScript
34
star
96

examples

TypeScript
33
star
97

introduction-to-angular

TypeScript
33
star
98

microsites

Master repository for sites on the angular.io subdomains (universal.angular.io, material.angular.io, etc)
HTML
29
star
99

core-builds

@angular/core build artifacts
JavaScript
29
star
100

ngtools-webpack-builds

Build artifacts for @ngtools/webpack
JavaScript
28
star