Skip to content

Read screenshot and description from readme #3672

Closed

Description

@fregante

Currently every feature description has to appear in both the readme and its file:

 - [](# "pr-jump-to-first-non-viewed-file") [Jumps to first non-viewed file in a pull request when clicking on the progress bar.](https://user-images.githubusercontent.com/16872793/85226580-3bf3d500-b3a6-11ea-8494-3d9b6280d033.gif)
void features.add({
	id: __filebasename,
	description: 'Jumps to first non-viewed file in a pull request when clicking on the progress bar.',
	screenshot: 'https://user-images.githubusercontent.com/16872793/85226580-3bf3d500-b3a6-11ea-8494-3d9b6280d033.gif'
}, …);

We could instead just parse it from the readme. To parse the data, I think we just need to change this function: Instead of loading each tsx file, we lookup the supplied id in readme.md and parse that

https://github.com/sindresorhus/refined-github/blob/42dfa16cd5366de26b475de94f8225003df07364/webpack.config.ts#L14-L37

Advantages

  • no need to maintain duplicate content
  • the build will effectively enforce documentation, or else it will fail (in watch mode this should probably just log an error)

Challenges (easy)

  • some features appear in the highlights table, so both need to be parsed
  • some features have 2 links in the readme, so either we pick one or allow multiple links in the options
  • we need to find another way to disable features. I think we can hardcode this list in webpack.config.ts so it can be injected exactly like it is now

Resulting code

 - [](# "pr-jump-to-first-non-viewed-file") [Jumps to first non-viewed file in a pull request when clicking on the progress bar.](https://user-images.githubusercontent.com/16872793/85226580-3bf3d500-b3a6-11ea-8494-3d9b6280d033.gif)
void features.add(__filebasename, …);

Activity

  1. added
    meta
    on Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedmetaunder discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions