diff --git a/flexmark/src/main/java/com/vladsch/flexmark/html/HtmlRenderer.java b/flexmark/src/main/java/com/vladsch/flexmark/html/HtmlRenderer.java index 8606e78b4..91a9db8c5 100644 --- a/flexmark/src/main/java/com/vladsch/flexmark/html/HtmlRenderer.java +++ b/flexmark/src/main/java/com/vladsch/flexmark/html/HtmlRenderer.java @@ -541,7 +541,7 @@ public void dispose() { this.myLinkResolvers = new LinkResolver[linkResolverFactories.size()]; this.doNotRenderLinksNesting = htmlOptions.doNotRenderLinksInDocument ? 0 : 1; this.htmlIdGenerator = htmlIdGeneratorFactory != null ? htmlIdGeneratorFactory.create(this) - : (!(htmlOptions.renderHeaderId || htmlOptions.generateHeaderIds) ? HtmlIdGenerator.NULL : new HeaderIdGenerator.Factory().create(this)); + : (!(htmlOptions.generateHeaderIds) ? HtmlIdGenerator.NULL : new HeaderIdGenerator.Factory().create(this)); htmlWriter.setContext(this); diff --git a/flexmark/src/main/java/com/vladsch/flexmark/html/renderer/CoreNodeRenderer.java b/flexmark/src/main/java/com/vladsch/flexmark/html/renderer/CoreNodeRenderer.java index 283c424db..813a8080b 100644 --- a/flexmark/src/main/java/com/vladsch/flexmark/html/renderer/CoreNodeRenderer.java +++ b/flexmark/src/main/java/com/vladsch/flexmark/html/renderer/CoreNodeRenderer.java @@ -117,7 +117,7 @@ void render(Document node, NodeRendererContext context, HtmlWriter html) { void render(Heading node, NodeRendererContext context, HtmlWriter html) { if (context.getHtmlOptions().renderHeaderId) { String id = context.getNodeId(node); - if (id != null) { + if (id != null && id.length() > 0) { html.attr("id", id); } }