add optional prefix to url
This commit is contained in:
@@ -100,6 +100,11 @@ func (r *Renderer) processObsidianImages(content string, notePath string) string
|
||||
imageURL = fmt.Sprintf("/serve_attached_image/%s", cleanPath)
|
||||
}
|
||||
|
||||
// Prefix with configured URL base
|
||||
if bp := r.config.URLPrefix; bp != "" {
|
||||
imageURL = bp + imageURL
|
||||
}
|
||||
|
||||
// Convert to standard markdown image syntax
|
||||
alt := filepath.Base(imagePath)
|
||||
return fmt.Sprintf("", alt, imageURL)
|
||||
@@ -127,6 +132,9 @@ func (r *Renderer) processObsidianLinks(content string) string {
|
||||
// Convert note name to URL-friendly format
|
||||
noteURL := strings.ReplaceAll(noteName, " ", "%20")
|
||||
noteURL = fmt.Sprintf("/note/%s.md", noteURL)
|
||||
if bp := r.config.URLPrefix; bp != "" {
|
||||
noteURL = bp + noteURL
|
||||
}
|
||||
|
||||
// Convert to standard markdown link syntax
|
||||
return fmt.Sprintf("[%s](%s)", displayText, noteURL)
|
||||
|
||||
Reference in New Issue
Block a user