diff --git a/static/styles.css b/static/styles.css index f523ec4..5336a8a 100644 --- a/static/styles.css +++ b/static/styles.css @@ -44,9 +44,17 @@ body { } } -h1, h2 { +h1, h2, h3 { font-weight: 100; line-height: 1.1em; + margin-bottom: 0.5em; +} + +.theme--default h2 { + color: #e32a6d; +} +.theme--dark h2 { + color: #e32a6d; } .theme--default a { @@ -56,6 +64,10 @@ h1, h2 { color: #fafafa; } +p { + margin-top: 0.5em; +} + .background { position: fixed; top: 0; diff --git a/static/styles.scss b/static/styles.scss index 3aabb25..a72116d 100644 --- a/static/styles.scss +++ b/static/styles.scss @@ -123,15 +123,24 @@ body { } } } -h1, h2 { +h1, h2, h3 { font-weight: 100; line-height: 1.1em; + margin-bottom: 0.5em; +} +h2 { + @include themed() { + color: t($accent1); + } } a { @include themed() { color: t($base7); } } +p { + margin-top: 0.5em; +} .background { position: fixed; top: 0; diff --git a/templates/note.html b/templates/note.html index 892a938..2317e3a 100644 --- a/templates/note.html +++ b/templates/note.html @@ -38,10 +38,13 @@
{{ if (not (eq .subject ""))}} -

{{.subject | escapeString}}

- {{ end }} {{ if (or (eq .kindID 30023) (eq .kindID 30024))}} - {{.content | mdToHTML | sanitizeXSS }} {{ else }} {{.content | - escapeString | basicFormatting }} {{ end }} +

{{.subject | escapeString}}

+ {{ end }} + {{ if (or (eq .kindID 30023) (eq .kindID 30024))}} + {{.content | mdToHTML }} + {{ else }} + {{.content | escapeString | basicFormatting }} + {{ end }}
diff --git a/utils.go b/utils.go index 010a4b5..b94df8c 100644 --- a/utils.go +++ b/utils.go @@ -180,77 +180,6 @@ func getPreviewStyle(r *http.Request) string { } } -func basicFormatting(input string) string { - lines := strings.Split(input, "\n") - - var processedLines []string - for _, line := range lines { - processedLine := replaceURLsWithTags(line) - processedLines = append(processedLines, processedLine) - } - - return strings.Join(processedLines, "
") -} - -func replaceURLsWithTags(line string) string { - var regex *regexp.Regexp - var rline string - - // Match and replace image URLs with tags - imgsPattern := fmt.Sprintf(`\s*(https?://\S+(\.jpg|\.jpeg|\.png|\.webp|\.gif))\s*`) - regex = regexp.MustCompile(imgsPattern) - rline = regex.ReplaceAllStringFunc(line, func(match string) string { - submatch := regex.FindStringSubmatch(match) - if len(submatch) < 2 { - return match - } - capturedGroup := submatch[1] - replacement := fmt.Sprintf(` `, capturedGroup) - return replacement - }) - if rline != line { - return rline - } - - // Match and replace mp4 URLs with