feat: H1 conversion on the API, markdown and import paths

- the /_journal/api/v1 post writes convert default and translated content
  in the write transaction and answer an additive notices key
- journal:import-posts converts and prints the converted count
  (ImportFromDirConfig, ImportStats.H1Converted)
- a category's pillar text saved in the admin answers
  editor.h1_converted_category
- every GET /categories row reports content_h1_to_h2 (additive key)
This commit is contained in:
Jakub Zych
2026-11-04 09:51:47 +01:00
parent 305f94afd9
commit faaa9b0f55
11 changed files with 459 additions and 42 deletions

View File

@@ -13,6 +13,7 @@ import (
translatemodels "git.golem15.com/golem15/sm-translate-plugin/models"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/bonfire"
"git.golem15.com/golem15/summercms/modules/compass"
"gorm.io/gorm"
)
@@ -251,6 +252,14 @@ func isEmptyValue(v any) bool {
return ok && s == ""
}
// appConfig is app's config, nil without an application.
func appConfig(app *backpack.App) *compass.Config {
if app == nil {
return nil
}
return app.Config
}
func mustDB(app *backpack.App) *gorm.DB {
if app == nil {
return nil