preface

Have you ever worked on a project that had readme. md and kept telling your colleagues to read it one by one after changing it? Have you ever had someone make a silly mistake when modifying code because they didn’t read readme.md? Do you have several or even dozens of readme. md in your project and have no way to find and read readme. md in time after it has been modified?

Now, with the rTF-Readme plug-in and related CLI tools, you don’t have to worry about that anymore.

Rtf-readme project address: github.com/digshare/rt…

VSCode plug-in address: marketplace.visualstudio.com/items?itemN…

Project discussion QQ group: 1029881641

RTF – ReadME project features overview

  • Support in VSCode, when opening/modifying a file, it reminds you of the README file that needs to be read to modify the file.
  • Support in CI, use the command line to see if someone has modified a file without reading the README you need to read.
  • In README support, glob Patterns are used to specify that certain files need to read this README when they are modified.
  • Support for glob patterns for writing parent directory paths in README files.
  • You can customize the path of the README to be prompted to view.

Walk through the plug-in features of the project

Rtf-readme project is divided into three parts: VSCode plug-in, command line client, command line server. In addition, Woodfan already provides a server that is automatically added to the configuration file when it is generated, so users of this project do not have to find a public network server to deploy. To use VSCode plug-in, command line client, you must have a configuration file in the project.

Let’s try to create a configuration file for the rtf-readme project using the VSCode plug-in.

First, we need to download the vscode plug-in rtf-readme. Type rTF-readme in the plug-in search box to find the RTF-readme plug-in and download it.

Once the download is complete, press Ctrl+Shift+P and type Create Config File in the box that pops up. Find the command “RtF-readme: Create Config File” provided by the RtF-readme plug-in.

Use the command “rtf-readme: Create Config File” to Create the configuration File. Generally, use the default SERVER URL (unless you have a rtF-readme service installed on a public network server yourself). The created configuration file is placed in the project root directory,

Let’s take a look at what’s in the configuration file.

As shown in the preceding figure, there are four subitems in the configuration file: (1) Server: IP address of the public network server that supports data center. (2) Token: a string used to specify a fixed item. Generally, a single token is used for each item. (3) Ignore: This field specifies the file to be ignored by the plug-in and command line tools. It supports the Glob pattern format. (4) Readme: Specifies the readme file path that the plug-in and command line tool need to take into account. The glob Pattern format is supported.

Once the configuration file is created, you can start using plug-in prompts and command line checks. Of course, to use it, we need to download the RtF-READme plug-in (which was installed earlier) and download the RtF-reame package from npm.js.

To prompt the plug-in to read the README file when it opens the file, we can first create a readme.md file in the root directory and type
, save readme. md, open other files in the project, and see VSCode’s prompt to read the README.

Alternatively, you can perform a check by executing YARN RTFR check in the project root directory to see if the file has been modified but the README has not been read. To test this functionality, you need two commits: commit the readme.md file, and then commit the readme.md associated file. In addition, the author of the second commit is different from the author of the first commit, and the author of the second commit did not read the readme.md of the first commit.

Observant kids may have noticed that after adding the glob patterns to the README file, an n-associated word appears at the top left of the file opened in VSCode.

This notation is added by the RTF-readme plug-in to mean that the file has a README associated with it. Clicking on the red box in the image above also brings up the name and path of the README file associated with this file.

Brief description of the server

To centralize the data read by the README, you need a server to hold the data. Why centralization? Because the data is stored locally, the data changes with the branch switch, which makes it difficult to maintain.

Two types of data are recorded on the server side: the README version read by the user and the COMMIT checked with rTF-readme Check. The former records the README version by recording the relative path of the README and the COMMIT hash of the README.

twitter

For those of you who don’t know what RTF stands for, RTF is short for read the F ***ing, okay