rc-lee / sitegen Goto Github PK
View Code? Open in Web Editor NEWStatic Site Generator
License: MIT License
Static Site Generator
License: MIT License
Continued from #16
Docusaurus' admonitions uses remark-admonitions alongside with MDX.
For SiteGen
or
New feature to add support for a horizontal rule in Markdown. The Markdown ---
should get converted to an <hr>
tag.
Many code blocks generated from Markdown have a copy to clipboard feature, like the ones on Docusaurus and the ones here on GitHub.
In https://github.com/rclee91/SiteGen/blob/main/bin/index.js#L107 you call a synchronous fs
method, but then pass it a callback function. Only the async versions work this way.
You have a few approaches to error handling:
console.log()
a messagethrow
and err
objectI would improve this a bit. What you do in 1. is good, but would be better done on stderr
vs. stdout
. Also, I would consider exiting the program with an error code vs. crashing with a stack trace:
if(err) {
console.error('Helpful error message here...');
process.exit(-1);
}
Hey, @rclee91 I would like to add new tests to your project. Could please assign me ?
Continued from issue #16
As documented, Docusaurus has built in support for the user to write JSX
inside Markdown files, that renders as React components.
A few detailed parts are required
However, as MDX uses React, might have to update SiteGen to use React, or forfeit this feature altogether.
You're using a stream
to process your file in https://github.com/rclee91/SiteGen/blob/main/bin/index.js#L104-L110. However, you aren't piping that into a write stream. You can pipe one stream into another, and then process things and add it to an existing output file, see https://nodejs.org/en/knowledge/advanced/streams/how-to-use-fs-create-write-stream/.
Also, your stream handling should deal with the error
event, and end
when the stream is finished.
In https://github.com/rclee91/SiteGen/blob/main/LICENSE#L3 you use a username vs. real name + email. In a legal document, you should consider using full name.
This feature will allow users to specify all of their SSG options in a JSON formatted configuration file instead of having to pass them all as command line arguments every time
It also will:
-c
or --config
flags accept a file path to a JSON config file.-c
or --config
option is provided, ignore all other options (i.e., a config file overrides other options on the command line).stylesheet
property.Instead of treating paths as regular strings, prefer to use built-in modules to support it. Paths are tricky to get right, especially cross-platform. Using path.join(), etc. will help a lot.
Continued from #16
Docusaurus has meta data for Markdown files as documented.
Data includes;
To implement Front Matter for Markdown,
For now the meta data are 'id', 'title', 'hide_title', 'description', 'stylesheet', 'image'
---
id: SomeFileName
title: a title
image: /image.url
---
# {{ title }}
[image]( {{ image }} )
Should alternate the Markdown file content as
# a title
[image]( /image.url )
I have tested the HTML files in Validator. I tried to input a folder to generate multiple files + index.html. Generated pages from processed text files were valid. However, the index.html failed markup validation. Please consider reviewing the image below.
Current static generator supports .txt files format.
I am going to add a new support for Markdown (.md) files. Specifically, I am going to implement several Markdown features: headers (1,2,3), links, italic and bold texts. In addition, I will provide documentation on Markdown support in README.md file.
With Docusaurus as a template, current markdown support for SiteGen is too basic, lacking many features.
Continued from issue #16
Code Blocks in Docusaurus have syntax highlights, this is a very user friendly feature.
Remarkable uses highlight.js for highlighting, which may be something that can be used.
New feature to add support for inline <code>
blocks. In Markdown, enclosing text in a single backtick causes the text to HTML to get rendered as <code>...text...</code>
.
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.