diff --git a/src/main/java/run/halo/highlightjs/HighlightJSHeadProcessor.java b/src/main/java/run/halo/highlightjs/HighlightJSHeadProcessor.java index 1288f75..222180e 100644 --- a/src/main/java/run/halo/highlightjs/HighlightJSHeadProcessor.java +++ b/src/main/java/run/halo/highlightjs/HighlightJSHeadProcessor.java @@ -21,6 +21,7 @@ import org.thymeleaf.spring6.SpringTemplateEngine; import org.thymeleaf.web.IWebRequest; import reactor.core.publisher.Mono; +import run.halo.app.plugin.PluginContext; import run.halo.app.plugin.ReactiveSettingFetcher; import run.halo.app.theme.dialect.TemplateHeadProcessor; @@ -38,6 +39,8 @@ public class HighlightJSHeadProcessor implements TemplateHeadProcessor { private final ReactiveSettingFetcher reactiveSettingFetcher; + private final PluginContext pluginContext; + private final RouteMatcher routeMatcher = createRouteMatcher(); private final TemplateEngine templateEngine = new SpringTemplateEngine(); @@ -68,18 +71,19 @@ public Mono process(ITemplateContext context, IModel model, IElementModelS private String highlightJsScript(BasicConfig basicConfig) { var context = new Context(); context.setVariable("config", basicConfig); + context.setVariable("version", pluginContext.getVersion()); var code = templateEngine.process( """ - - + + - - + + - +