add some docs

This commit is contained in:
maddalax 2024-09-20 12:18:22 -05:00
parent 91efc11984
commit 08337c9e8a
3 changed files with 61 additions and 6 deletions

View file

@ -1,6 +1,61 @@
### **Installation Instructions**
## **Getting Started**
##### 1. **Install htmgo**
```bash
go install github.com/maddalax/htmgo@latest
go run htmgo template
```
go install github.com/maddalax/htmgo/cli/htmgo@latest
```
**2. Create new project**
Once htmgo cli tool is installed, run
```bash
htmgo template
```
this will ask you for a new app name, and it will clone our starter template to a new directory it creates with your app name.
**3. Running the dev server**
htmgo has built in live reload on the dev server, to use this, run this command in the root of your project
```bash
htmgo watch
```
If you prefer to restart the dev server yourself (no live reload), use
```bash
htmgo run
```
##### **4. Core concepts**
View the [core concepts](/docs#concepts) of how to use htmgo, such as adding pages, using partials, routing, etc.
**5. Building for production**
htmgo cli can be used to build the application for production as a single binary
```bash
htmgo build
```
it will be output to **./dist**
<br>
## **Troubleshooting:**
**command not found: htmgo**
ensure you installed htmgo above and ensure GOPATH is set in your shell

View file

@ -11,7 +11,7 @@ func DocsPage(ctx *h.RequestContext) *h.Page {
return h.NewPage(base.RootPage(
h.Div(
h.Class("flex flex-col p-4 justify-center items-center"),
h.Class("flex flex-col justify-center items-center"),
h.List(pages, func(page dirwalk.Page, index int) *h.Element {
return MarkdownContent(ctx, page.FilePath)
}),

View file

@ -27,7 +27,7 @@ func MarkdownContent(ctx *h.RequestContext, path string) *h.Element {
renderer := service.Get[markdown.Renderer](ctx.ServiceLocator())
return h.Div(
h.Article(
h.Class("prose max-w-[95%] pt-3 md:p-4 md:max-w-2xl prose-code:text-black"),
h.Class("prose max-w-sm pt-3 p-4 md:p-4 md:max-w-2xl prose-code:text-black"),
h.Raw(renderer.RenderFile(path)),
),
)