Documentation
¶
Overview ¶
Package server runs a loopback HTTP server that re-renders Markdown (and neighbouring source files) on demand, so that relative links in the rendered HTML keep working when the user clicks through to another file in the same tree.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func Start ¶
Start binds a TCP listener on 127.0.0.1 with an OS-assigned port and begins serving. Requests are sandboxed to rootDir (after symlink resolution); any path that escapes the root is rejected with 403. Call Stop to shut down.
func (*Server) OpenInBrowser ¶
OpenInBrowser opens the platform browser pointed at the given file.
func (*Server) URLFor ¶
URLFor builds the loopback URL that renders the given file. The path is resolved to absolute form and symlinks are followed so the URL matches where the file actually lives; relative links inside the rendered HTML then resolve relative to the real file's directory rather than the symlink's parent. If the file does not exist (e.g. a URL for a broken link the caller still wants to fetch), the parent directory is canonicalised instead so the resulting URL still survives the server's lexical sandbox check.