Git Product home page Git Product logo

rost_gen's Introduction

rost_gen

A simple static site generator that generates basic .html files from .txt files.

Getting started

This project requires that you have Rust and Cargo installed on your device.

git clone [email protected]:Eakam1007/rost_gen.git
cd rost_gen
cargo build --release

This will create the optimized build in the ./target/release directory. Run the project by changing into the release directory:
cd target/release

Usage

./rost_gen[.exe] [OPTION]
Option Description
-v, --version Print tool name and version
-h, --help Print help message with a list of options
-i, --input [PATH] Provided a path to a text(.txt) or Markdown (.md) file, generate an html file
Provided a path to a directory, generate html files for all text(.txt) and Markdown (.md) files in that directory
Warning: will output generated html files to the ./dist directory, replacing any existing content
-o, --output [PATH] Optional: Use to specify an output directory:
-i, --input [INPUT_PATH] -o, --output [OUTPUT_PATH]

This will not delete any existing content in the specified directory. If the directory doesn't exist, it will be created
-l, --lang [LANG] Optional: Use to specify the language (lang attribute of the html tag) of html file. Defaults to "en-CA"

Features

  • Specify a title in text and Markdown files

    Specify a title in the text and Markdown files by leaving two blank lines after the first line:

    This is a title 
    
    
    First line of text
    

    The first line will then be used as the title for generated html file, and the generated html body will include a <h1> tag with the title:

    <body>
      <h1>
        This is a title
      </h1>
      <p>
        First line of text
      </p>
    
  • Seperate paragraphs with blank lines

    Excluding the title, specify the end of a paragraph and the start of a new paragraph by seperating them with blank lines:

    This is a title
    
    
    First line of first paragraph
    
    First line of second paragraph
    Second line of second paragraph
    

    This will result in two <p> tags in the generated html:

    <h1>
      This is a title
    </h1>
    <p>
      First line of first paragraph
    </p>
    <p>
      First line of second paragraph
      Second line of second paragraph
    </p>
    
  • Header detection for .md files

    # This line is header
    

    will be converted to

    <h1>
      This line is header
    </h1>
    
  • Thematic Break detection (horizontal rule) for .md files

    ---

    will be converted into

    <hr />

Examples

  • One input file

    To convert the "file_to_convert.txt" in current directory:
    ./rost_gen --input ./file_to_convert.txt
    
    or to convert "file_to_convert.md" in current directory:
    ./rost_gen --input ./file_to_convert.md
    
  • One or multiple input files in a directory

    To convert all .txt files in the "folder_with_input_files directory" in the current directory:
    ./rost_gen -i ./folder_with_input_files
    
  • Specify an output directory:

    Output to the "custom_output_dir" in the current directory:
    ./rost_gen -i ./file_to_convert.txt -o ./custom_output_dir
    
  • Specify language for generated html:

    ./rost_gem -i ./file_to_convert.txt -l fr
    
    This will update the lang tag of the html tag in the generated html file:
    <html lang="fr">
    ...

rost_gen's People

Contributors

eakam1007 avatar cdphu avatar

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.