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

Add flag to CLI to generate text READMEs #47

Open
olistic opened this issue May 3, 2018 · 11 comments
Open

Add flag to CLI to generate text READMEs #47

olistic opened this issue May 3, 2018 · 11 comments
Labels
good first issue Looking to contribute? Start here! pkg: cli Pertaining to @warriorjs/cli status: claimed Issues that are currently being worked on by someone type: feature A potential feature to be added

Comments

@olistic
Copy link
Owner

olistic commented May 3, 2018

Level READMEs in markdown format could be great if you're using some kind of markdown processor to read them. If you're not planning on doing so, having the markdown syntax laying around creates noise. Running warriorjs --no-markdown should take care of that, and output to README.txt instead of README.md.

@olistic olistic added good first issue Looking to contribute? Start here! pkg: cli Pertaining to @warriorjs/cli type: feature A potential feature to be added labels May 3, 2018
@justdvnsh
Copy link

Hello @olistic ,
I am a newbie , and this would be my second ever contribution. I would like to tackle this problem .

@olistic
Copy link
Owner Author

olistic commented Jun 17, 2018

Hello @justdvnsh, that'd be awesome. How are you planning to tackle this?

@justdvnsh
Copy link

justdvnsh commented Jun 17, 2018

So, i guess , after adding the -n or --no-markdown arg in the argument file parseArgs.js I am planning to write a simple md to txt parsing engine using regex. Because I dont find any md to txt parsing libraries out there.. Also , the txt files , would not be containing the text decorations and images.

  1. Use readFileSync to read the md file
  2. Feed it to the md to txt parser so to remove the md elements , and images
  3. use writeFileSync to write the txt files.

What do you think ? Will this approach work ? It's a bit tedious though !

@olistic
Copy link
Owner Author

olistic commented Jun 17, 2018

There are some libraries that strip markdown formatting characters from text you can try, like remove-markdown, but I don't know how well they'll fit our use case. What if you just create another ejs template, but for the README.txt?

@justdvnsh
Copy link

Yes , using an ejs template seems like a pretty good option . We can make the characters dynamic . But still, we would need to change all the readme files to add the dynamic content.

So , I guess , instead of attaching readme files with the game , we can attach those ejs templates with the static data, in which the dynamic data ( i.e. markdown formatting chars ) will be populated on the fly , after the user specifying wether he needs markdown or text .

How about that ? Sounds good ?

@olistic
Copy link
Owner Author

olistic commented Jun 17, 2018

If I understood correctly, you're suggesting using the existing template but making the markdown formatting characters visible only when markdown is enabled? I thought of that but I think the template will get too convoluted. That's why I suggest having another template/set of templates called README.txt.ejs. This also allows us to make different formatting choices if we wanted in the text README, like this:

Markdown:

# Spartacus - beginner

## Level 1

...

Text:

Spartacus - beginner
--------------------

Level 1

...

@justdvnsh
Copy link

Yes ,you understood that correctly. Yes , even I was wondering, that it will convolute the template . But I didn't really understand the solution you gave . If we will be using the README.txt.ejs template , then what will get added to it ( what will be the dynamic data ?

@olistic
Copy link
Owner Author

olistic commented Jun 17, 2018

The existing template is called README.md.ejs, which includes all the markdown formatting characters and is used to generate the markdown README (README.md). We can add another template called README.txt.ejs without markdown and use that to generate the text README (README.txt) when the --no-markdown flag is passed. The data we pass to the template in the render function should be the same for both templates, the only different is the file format and layout.

@justdvnsh
Copy link

justdvnsh commented Jun 17, 2018

Okay yes . That sounds a pretty good solution.
Should I start implementing the feature ?

@olistic
Copy link
Owner Author

olistic commented Jun 17, 2018

Go for it! Thanks

@olistic olistic added the status: claimed Issues that are currently being worked on by someone label Jun 17, 2018
@justdvnsh
Copy link

Sure thing !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Looking to contribute? Start here! pkg: cli Pertaining to @warriorjs/cli status: claimed Issues that are currently being worked on by someone type: feature A potential feature to be added
Projects
None yet
Development

No branches or pull requests

2 participants