Code Monkey home page Code Monkey logo

cv-ssg's Introduction

cv-ssg's People

Contributors

hlavu avatar minhhang107 avatar tuanthanh2067 avatar

Watchers

 avatar

cv-ssg's Issues

Markdown File Support

Hi tuanthanh2067!

Feature

I am interested in your project and I would like to add support for Markdown (.md files) in it.

Example

If users inputs a text file, nothing will change. If a Markdown file is used as input, only the header one syntax feature will be converted into HTML.

If you would like this feature please assign me this issue and reply to let me know. Thanks!

set options instead or argument variables

Instead of using argument variables, try using actual options which can make the work easier.
options
Over here, you need to check all the arg variables through if conditions which makes the process lengthy, error prone and time consuming. I suggest you to try using options instead which would make has pros on the above mentioned points and is much easier to use! There are many npm frameworks like commander and yargs which can do that. Follow this link which leads to use options through commander package.
Hope this helps

---v, version not working

when i try to see the version of the tool with -v or --version options, it gives the this error.
Its is bit wierd. Please resolve it. thanks
version

Add support images

I'm thinking about adding static images which will be stored in an assets folder. This only works when user indicates it in .json file and provide the path for assets folder

This will only works on .md files

Json file example

{
  "input": "./site",
  "stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css",
  "assets": "./assets"
}

Steps

  1. I will read the asset folder to get each image file name and store it in an array
  2. Read through every .md file to see if any of those images are used
  3. Move images which are used to an assets folder under dist folder

Add initial support for Markdown

Hi Thanh, I would like to add a new feature for you tool, which is to support Markdown extension.

I'm going to implement the following:

  • Modify the validateExtension() so the tool allows both .txt and .md files
  • Modify readFile module to process Heading 1 markdown syntax
  • Update documentation accordingly

Let me know if you have any requests for the feature.

Add new feature: Support --config with config file

Hi Dustin, I would like to add a new option -c or --config to your repo. This allows users to specify a config file storing options' values.
By doing so, a user could run the SSG in 2 ways:

#1:
ssg --input ./site --output ./build --stylesheet https://cdn.jsdelivr.net/npm/water.css@2/out/water.css --lang fr

#2:
ssg --config ./ssg-config.json

ssg-config.json content:
{ "input": "./site", "output": "./build", "stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css", "lang": "fr" }

#Tasks:

  • The -c or --config flags accept a file path to a JSON config file.
  • If the file is missing, or can't be parsed as JSON, exit with an appropriate error message.
  • If the -c or --config option is provided, ignore all other options (i.e., a config file overrides other options on the command line).
  • The program should ignore any options in the config file it doesn't recognize. For example, if the SSG doesn't support stylesheets, ignore a stylesheet property.
  • If the config file is missing any options assume the usual defaults. For example, use dist/ as the output directory if it isn't specified.
  • Update README.md

Exit the program with an error code in case of error

You're doing a good job of printing an error message when something goes wrong, for example: https://github.com/tuanthanh2067/cv-ssg/blob/main/bin/cv-ssg.js#L40. However, I would consider exiting the program and giving an error code for the process as well:

if (err) {
  console.log(chalk.yellow(`Can not open ${file}`));
  return process.exit(1);
}

You should always "crash"/exit a program when it gets into a state that it can't continue, and give an indication to the OS that it has failed (using 1 or another non-zero exit code).

text is not align

Hi, I think it could look better if all the text is align in the console like for -h.
textAlign

Refactor readPath file

The file can be found under bin/helpers/readPath.js

  1. Add a new class called handleFile
  2. Move every handle function (json, md, txt, folder) to that file
  3. readPath file may return path, extension (which is currently called target) and results from reading that path
  4. Fix bug that occurs while refactoring

Use different colours for suggess vs. failure

You are using chalk to add colour to the log output. I think you can improve it by using different colours when things work (e.g., green) vs. fail (e.g., yellow or red). Consider this code:

    console.log(chalk.yellow("Convert to html successfully"));
  } catch (err) {
    console.log(chalk.yellow("Can not convert file"));

In both cases you use yellow.

.gitignore shouldn't assume root dirs

Your .gitignore file is specifying absolute paths to the root (e.g., /node_modules), and you should give the name of the dirs as relative paths:

node_modules
.env
dist
test
test.txt

I would be careful adding test to this, though, since we'll be adding tests later and you might wonder why you can't include them!

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.