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

document VT features in docstrings #2386

Merged
merged 26 commits into from Feb 4, 2020
Merged

Conversation

jerch
Copy link
Member

@jerch jerch commented Aug 18, 2019

PR to document VT features inline in docstrings.

@Tyriar Was not able to get this working with typedoc, it does not work with our repo/project structure (throws tons of errors). Thus I parse the comments myself in bin/extract_vtfeatures.js.

Currently it respects the following notations:

  • single line only with basic data
// @vt: <status> <kind> <mnemonic> <"name"> "<sequence>" "<short description>"
  • multiline with optional long description
/**
 * ...
 * @vt: <status> <kind> <mnemonic> "<name>" "<sequence>" "<short description>"
 * Some longer description for this goes here until next empty line...
 *
 * ...
 */

You can either run the command with node bin/extract_vtfeatures.js src/**/*.ts or as yarn run --silent vtfeatures which outputs a markdown document with tables of the features.

Next steps:

  • integrate this somehow into the wiki/webpage, maybe rebuild those with every release
  • document all existing features in InputHandler
  • respect long descriptions in output to further document special cases

@jerch jerch self-assigned this Aug 18, 2019
@jerch jerch added type/documentation Regarding website, API documentation, README, etc. type/enhancement Features or improvements to existing features labels Aug 18, 2019
@jerch
Copy link
Member Author

jerch commented Aug 18, 2019

Created a stub wiki page with the output: https://github.com/xtermjs/xterm.js/wiki/VT-features

@jerch jerch added the work-in-progress Do not merge label Aug 18, 2019
@jerch
Copy link
Member Author

jerch commented Sep 5, 2019

@Tyriar I think the feature descriptions are better moved to the function declarations instead of the registering step. This would save some duplicated descriptions. Have to update the "parser" for this (currently does not support multiple @vt sections in multiline comments).

src/InputHandler.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@jerch
Copy link
Member Author

jerch commented Jan 9, 2020

Writing @vt: docstrings has now the following parsing rules:

  • a vt feature is declared by a @vt: token at the start of a comment line (only TS files are scanned)
  • first line denotes the content of the main tables in this form:
// @vt: <status> <kind> <mnemonic> "<name>" "<sequence>" "<short description>"
  • follow up lines are used as long description
  • long description ends after 2 empty lines, a new @vt: token or at the end of a multiline doc string
  • long description can contain markdown syntax supported by kramdown (jekyll)
  • For status there are some macros defined. These can be used in the status field of the single line, or anywhere in the long description.
    • #Y: supported
    • #N: unsupported
    • #P[some reason]: partial support with reason in title
    • #B[some reason]: broken support with reason in title

@jerch
Copy link
Member Author

jerch commented Jan 10, 2020

@Tyriar The basic stuff is done. Not sure yet where the automatic build script should end up. As far as I see, the API doc updates are scripted in xtermjs.org repo, imho it would work likewise for the vtfeatures. Once this has landed, a build script in the website repo could do something like this:

git clone https://github.com/xtermjs/xterm.js.git
cd xterm.js
yarn
yarn run --silent vtfeatures > target_file_in_website_repo.md

Then just build the created markdown file along with others in the website project.

Up for review.

@jerch jerch removed the work-in-progress Do not merge label Jan 10, 2020
@Tyriar Tyriar added this to the 4.4.0 milestone Jan 13, 2020
@Tyriar
Copy link
Member

Tyriar commented Feb 4, 2020

Created a follow up xtermjs/xtermjs.org#118

@Tyriar Tyriar merged commit 5458077 into xtermjs:master Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/documentation Regarding website, API documentation, README, etc. type/enhancement Features or improvements to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants