Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically check documentation for compile errors #104

Closed
dsherret opened this issue Oct 24, 2017 · 5 comments
Closed

Automatically check documentation for compile errors #104

dsherret opened this issue Oct 24, 2017 · 5 comments

Comments

@dsherret
Copy link
Owner

dsherret commented Oct 24, 2017

It should be very easy to check the documentation for compile errors. I don't think this needs to be that flexible. The following should be beneficial enough for now:

  1. Grab all the code out of the .md files by looking for the three backticks.
  2. For each code section concatenate with some global code that types some variables used in the documentation. Check each source file for errors and output where they occur.

Edit (2018-04-17): I'll probably be moving and improving this functionality out into a library sometime

Edit (2018-07-21): Using "configuration comments" (https://github.com/eslint/eslint-plugin-markdown) would probably be a better idea than storing meta-data in the first line of the code block.

@dsherret dsherret changed the title Check documentation for compile errors Automatically check documentation for compile errors Oct 24, 2017
@dsherret
Copy link
Owner Author

dsherret commented Apr 13, 2018

Important to note that meta-data seems to be allowed to be stored after the specified language in the info string: https://github.github.com/gfm/#example-112

That could be used for defining the setup for a code block.

@dsherret
Copy link
Owner Author

dsherret commented Apr 15, 2018

This currently only works in ts or typescript code blocks.

Example using a "setup" for the code block:

```ts setup: let grandParentDir: Directory, childDir: Directory;
grandParentDir.isAncestorOf(childDir);   // true
childDir.isDescendantOf(grandParentDir); // true
````

Example of ignoring a compile error:

```ts ignore-error: 1109
// given an existing node and type checker
const classNode: ts.ClassDeclaration = ...;
const compilerTypeChecker: ts.TypeChecker = ...;

// etc...
````

It also uses this file to define all the globals: https://github.com/dsherret/ts-simple-ast/blob/master/docs/_script-templates/main.ts

@dsherret
Copy link
Owner Author

dsherret commented Apr 16, 2018

Hmmm... seems like github is not following https://github.github.com/gfm/#example-112 for how markdown should be displayed on github pages.

Edit: I emailed github pages support.

dsherret added a commit that referenced this issue Apr 16, 2018
@dsherret
Copy link
Owner Author

GitHub pages gave a very helpful reply. I need to add markdown: GFM to _config.yml.

dsherret added a commit that referenced this issue Apr 16, 2018
…n't follow github flavored markdown spec."

This reverts commit 559c7af.
dsherret added a commit that referenced this issue Apr 16, 2018
…ing the documentation (instead of the package)

Also, improve performance.
dsherret added a commit that referenced this issue Apr 16, 2018
…ing the documentation (instead of the package)

Also, improve performance.
@dsherret
Copy link
Owner Author

This is all done now and the markdown files in this library have type checking in them.

Overall, found 19 bugs in the documentation... and surprisingly 2 bugs in the library (this and this).

dsherret added a commit that referenced this issue May 14, 2019
dsherret added a commit that referenced this issue May 14, 2019
…n't follow github flavored markdown spec."

This reverts commit 559c7af.
dsherret added a commit that referenced this issue May 14, 2019
…ing the documentation (instead of the package)

Also, improve performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant