Skip to content

Commit

Permalink
Updated docs + fix ui bug when no title in md file is provided + upda…
Browse files Browse the repository at this point in the history
…ted README + [Version 0.5.0]
  • Loading branch information
Padi2312 committed Apr 13, 2024
1 parent 94b31d5 commit f2846d3
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 40 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,49 @@ See Dorcs in action [here](https://dorcs.allthing.eu). (same link as the documen

- **Page Metadata:** Provide a title for a certain page. You can also provide the position of the page in the sidebar.

- **Hot Reload:** In watch mode, Dorcs watches the source directory for changes and regenerates the documentation whenever a change is detected.

- **Built-in Server:** Dorcs starts a local server to preview the generated documentation.

## 📄 Documentation

The documentation is can be found in the `docs` directory. The documentation website is generated using Dorcs itself.
It is also online available at [dorcs.allthing.eu](https://dorcs.allthing.eu).
The documentatoin is available at **[dorcs.allthing.eu](https://dorcs.allthing.eu).**

The website is generated using Dorcs itself, you can find the source code for the documentation inside the `docs` directory.


## 🛠️ Setup

### 📥 Binary

Download pre-built binaries from the [releases section](https://github.com/Padi2312/dorcs/releases) for a quick start.

#### 🧪 Experimental
### 🛠️ Build from Source

To build from source, you need to have Go(lang) installed.

Clone the repository and run the following commands inside:

```sh
go generate ./build/gen.go

go build -o dorcs .
```


### 🧪 Experimental

In `develop` branch you can find the latest features and changes. Use with caution, there may be not working features or breaking changes.

You can find the nightly builds marked as pre-releases in the [releases section](https://github.com/Padi2312/dorcs/releases)

## 📚 Usage

To generate documentation, run the following command in your project with the documentation folder:
1. Create a `docs` directory with an `index.md` file in it. This will be the landing page of your documentation.
2. Run Dorcs in the directory with the `docs` folder.

```sh
dorcs
```

This will generate the documentation in the `output` directory.

## ⚙️ Configuration

Dorcs provides some settings that can be configured. The following are the default settings:

| Setting | Description | Type | Default Value |
| -------- | ------------------- | ------ | ------------- |
| `title` | Title in the navbar | string | Documentation |
| `source` | Source directory | string | ./docs |
| `output` | Output directory | string | ./output |

You can override the default settings with the `dorcs.config.json` file. This file should be in the root of your project.

```json
{
"title": "My Documentation",
"source": "./my_docs",
"output": "./my_output"
}
```
3 changes: 0 additions & 3 deletions docs/06_nice_to_have.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ If you have any suggestions, feel free to open an issue on the [GitHub repositor

## Code Blocks

- Syntax highlighting for code blocks
- Support for multiple languages
- Title for code blocks
- Line numbers for code blocks
- Copy to clipboard button for code blocks
- Expandable code blocks

## For starters
Expand Down
19 changes: 19 additions & 0 deletions docs/changelog/04_version_0_5_0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Version 0.5.0
position: -3
---

# Version 0.5.0

## Features 🚀
- Syntax highlighting for code blocks 🎨
- Also supports dark mode 🌙
- Copy-to-clipboard button for code blocks 📋


## Bug Fixes 🐛
- Fixed issue in sidebar when no title is provided in metadata (show filename instead)

## Limitations ⚠️
- When using the `--watch` flag and adding new files or changing title/position, the server needs to be restarted to reflect the changes.
- This is going to be fixed in the next release.
13 changes: 6 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ position: 1
<strong>Static site generator in a single file 📄</strong>
</p>

Dorcs is a static site generator that transforms markdown files into a website. It is designed to be simple and easy to use, requiring no external dependencies other than a single binary file.

It's currently in development and get more features in the future. For now it's suitable for small non complex projects.
Dorcs is a static site generator that transforms markdown files into a website. \
It is designed to be simple and easy to use, requiring no external dependencies other than a single binary file.

<div style="background-color: #f6e05e; padding: 10px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<p style="font-weight: bold; color: #333; text-align: center;">
⚠️ This project is still in development and may introduce breaking changes in the future. Use with caution. ⚠️
</p>
</div>

**NOTE:** You will see the latest features and changes of the development branch right here. Don't worry if there are some features mentioned here that are not available in the current release. They will be available _soon_.

## 🚀 Features

- ✅ Markdown to HTML conversion
Expand All @@ -35,9 +32,11 @@ It's currently in development and get more features in the future. For now it's
- ✅ Page metadata like title and position in the sidebar
- ✅ Support for images and media files
- ✅ Nested sidebar navigation for subpages
- ✅ Responsive design + nice ui + dark mode
- ✅ Responsive design and dark mode
- ✅ Syntax highlighting for code blocks
- ✅ Hot reload in watch mode
- ✅ Built-in server for previewing the generated documentation
- [ ] Customizable templates
- [ ] Syntax highlighting for code blocks
- [ ] Search functionality
- [ ] Support for multiple languages
- [ ] Plugin system for extending functionality
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/components/MenuSection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{/if}

{#if route.children?.length !== 0}
<button class="hover:bg-gray-300 rounded-md p-1" on:click={toggleOpen}>
<button class="hover:bg-gray-300 rounded-md" on:click={toggleOpen}>
{#if open}
<IconChevronDown />
{:else}
Expand All @@ -42,7 +42,7 @@
<svelte:self route={child} />
{:else}
<a
class="menu-section-title"
class="menu-section-title my-1"
href={child.url.replace("pages/", "/")}
on:click
>
Expand Down
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/padi2312/dorcs/pkg/utils"
)

var version = "0.4.0"
var version = "0.5.0"

//go:embed frontend/dist/*
var assets embed.FS
Expand Down Expand Up @@ -72,14 +72,13 @@ func main() {
})
}


if isWatchMode || isPreviewMode {
quit := make(chan os.Signal, 1)
server.Start()
go server.Start()
signal.Notify(quit, os.Interrupt)

<-quit
slog.Info("🚀 Exiting dorcs...")
slog.Info("🛑 Exiting dorcs...")
}

}
7 changes: 7 additions & 0 deletions pkg/dorcs/dorcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ func (d *Dorcs) processMarkdownFiles(files []string) error {

func (d *Dorcs) ProcessFile(file string) error {
df := NewDorcsFile(file)
var title = df.MetaData.Title
// In case title is not provided, use the file name as title
if title == "" {
// Get only file name without extension
title = strings.TrimSuffix(filepath.Base(file), filepath.Ext(file))
df.MetaData.Title = title
}
n := &navigation.Node{
Path: df.Path,
Title: df.MetaData.Title,
Expand Down

0 comments on commit f2846d3

Please sign in to comment.