Code Monkey home page Code Monkey logo

Comments (11)

justdvnsh avatar justdvnsh commented on May 4, 2024

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

from warriorjs.

olistic avatar olistic commented on May 4, 2024

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

from warriorjs.

justdvnsh avatar justdvnsh commented on May 4, 2024

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 !

from warriorjs.

olistic avatar olistic commented on May 4, 2024

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?

from warriorjs.

justdvnsh avatar justdvnsh commented on May 4, 2024

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 ?

from warriorjs.

olistic avatar olistic commented on May 4, 2024

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

...

from warriorjs.

justdvnsh avatar justdvnsh commented on May 4, 2024

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 ?

from warriorjs.

olistic avatar olistic commented on May 4, 2024

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.

from warriorjs.

justdvnsh avatar justdvnsh commented on May 4, 2024

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

from warriorjs.

olistic avatar olistic commented on May 4, 2024

Go for it! Thanks

from warriorjs.

justdvnsh avatar justdvnsh commented on May 4, 2024

Sure thing !

from warriorjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.