a-rokay / static-site-generator Goto Github PK
View Code? Open in Web Editor NEWRelease 0.1
License: MIT License
Release 0.1
License: MIT License
The pygments.css reference should only be applied to markdown files, because they are the only files to generate and use pygments.css. This will probably need to be done in the generate_html
function.
html_skeleton = """<!doctype html>
<html lang="{lang}">
<head>
<meta charset="utf-8">
<title>{title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/pygments.css">{stylesheet}
</head>
<body>
{content}
</body>
</html>
"""
For this issue, I will be implementing a new feature to the static-site-generator.
This new feature will allow the ability to use a config file within the static-site-generator to allow users to specify the config file instead of typing out all of the necessary command arguments. This will clean up the user's input, and allow for quick modification of arguments on the user's end.
The config file will be JSON formatted. Use below as an example.
{
"input": "./docs",
"output": "./web",
"future-feature": "should be ignored for now"
}
The command line will be able to do this.
{
Option 1: use command line arguments:
ssg --input ./site --output ./build --stylesheet https://cdn.jsdelivr.net/npm/water.css@2/out/water.css --lang fr
Option 2: use a config file
ssg --config ./ssg-config.json
}
Currently, a lot of markdown features are missing. I'm looking at implementing this library to bring in more features. The library has a markdown
function that takes in a markdown string and returns html, the same signature we have in our process_markdown
function.
html = markdown.markdown(your_text_string)
So, I'll simply replace the logic in process_markdown
with the new library's processing.
Currently, the markdown parsing for bold and italics seems overcomplicated. I will try to simplify it by removing the lambda statements and using groups.
I will add a new passable argument "--lang"/"-l", that allows the user to set the language of the generated html. The language they pass will be set in the root html tag like so:
ssg.py -i input.txt -l pt-BR
<!doctype html>
<html lang="pt-BR">
...
If the lang argument is not used, "en" will be set as the language.
There needs a function that allows us to add assets to the asset folder. As an example, I'm currently working on issue #12, which requires an external CSS stylesheet for highlighted code blocks. I need to be able to create a CSS asset folder in dist/assets/
that contains the stylesheet.
In line 105, Please check if I try a folder that ends with .txt will that run or will it produce an error.
I would like to add markdown support to your SSG. The following functionalities will be added:
.md
files as input__test__
or **test**
will become "test")_test_
or *test*
will become "test")# test
will become <h1>test</h1>
etc.)After reviewing and testing your code, I have come up with the following plan:
get_txt_files()
function to add filtering for .md
file.txt
files, but does not have an equivalent method to validate file input yet, so I'll also add a file input validator function that will only accept .txt
and .md
as supported file inputfile_name.replace(".txt", ".html")
. I will modify this to add support for .md
files.process_content()
to check for markdown syntax and process them. Then I will call this function inside your generate_content() function. I believe this approach will make it easier to modify the markdown processing algorithm in the futurePlease let me know if you have any questions or suggestions regarding this plan.
A main index.html with links to each page should be created and stored in dist
.
Generated files should be put in their own folders as index.html
, similar to docusaurus:
This will help keep the hierarchy clean and the url for each page will look more professional. I also think there should be an assets
folder that holds CSS, images, etc.
Working on issue #12, I've realized that I need a local CSS file that holds the styling for each code highlight. The assets
folder could be generated from main
and populated when needed.
Please add the python version required and make the readme more informative. You can also share code if you like.
There are a number of Usage examples given, but no explanation for any of them or what they do. Later you list the help output, but it would be good to give some explanation of how each of the different args/flags work, when to use them, how to combine them, etc.
Any markdown features noticed to be missing can be posted here.
Currently, the method of getting the file_name is not robust.
def output_to_file(file_name, html):
file_name = file_name.replace(file_name[file_name.rfind("."):], "")
...
The current method simply strips the extenstion which leads to errors if the input is a single file that resides in a folder.
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'dist/Sherlock Holmes Selected Stories/test'
Also, the file_name
parameter is not named properly, it should be file
.
I will expand the markdown parser to include inline code blocks. Text encased by single backticks will be encased in <code>
tags in the resulting html, like so:
1234 `567` 89
1234 <code>567</code> 89
I would recommend changing a-rokay
to a proper name and email address in your License file:
https://github.com/a-rokay/static-site-generator/blob/main/LICENSE#L3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.