Generate HTML pages from markdown, using pure C. Inspired by suckless.org and 512kb.club
Go to file
2024-08-29 14:38:33 -04:00
.gitignore Initial commit 2024-08-29 13:50:35 -04:00
input.md Project Genesis 2024-08-29 14:36:45 -04:00
LICENSE Initial commit 2024-08-29 13:50:35 -04:00
markdown_to_html.c Project Genesis 2024-08-29 14:36:45 -04:00
output.html Project Genesis 2024-08-29 14:36:45 -04:00
README.md Adding a "bug" 2024-08-29 14:38:33 -04:00
styles.css Project Genesis 2024-08-29 14:36:45 -04:00

c-staticsite-generator (WIP NOT COMPLETE)

Abstract

In this project we attempt to write a fast and minimal static site generator. The generator will accept plaintext markdown and produce HTML as it's artifact(s). Users may extend this software in automated pipelines to deploy blogs, marketing sites, or online documentation. This project is heavily inspired by by suckless.org and 512kb.club

Requirements

The author(s) assumes the reader posesses a C compiler, git client, text editor, and working knowledge of C, HTML, and CSS.

Tooling

  • Modern C compiler (gcc and tcc work well)
  • Relevant C libraries
    • stdio.h
    • string.h
    • stdbool.h
    • stdlib.h

Usage

  1. Install dependencies
  2. Clone this repository
  3. Record any prose you want using Markdown
  4. Draft a CSS file to your taste
  5. Build the binary tcc -Wall -o ssg.exe markdown_to_html.c
  6. Call the binary ./ssg.exe input.md output.html
  7. View the output in any web browser
  8. Return to step 3 until you are satisfied

Testing and Debugging

A sample Markdown and CSS file is available for testing the generator. To debug the generator, we recommend enabling debug and warning flags on your compiler.

"Bugs"

  • Markdown spec is not fully supported (tables, strikethrough, etc..)
  • Styling is done manually via CSS
  • Generator does not indent HTML correctly
  • No "Table of Contents" or "Site Map" support (yet)

Attribution

Warning

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

TL;DR: Not my problem

License

The GPL V2 license applies to this project. All copyrights belong to their respective copyright holders and all trademarks belong to their trademark holders.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.)