Summary / In Short... / TL;DR
Use headings. Many scholarly articles and papers have an abstract or formal introduction that explains what was attempted and what the results were. State your most salient and action-oriented stuff up at the top, then go into full detail in the body.
The Introductory Paragraph
The common approach I've seen (and used) is to place a "Summary", "Introduction", "In Short...", "TL;DR" (or "Too Long; Didn't Read"), etc. section at the top with a brief summary of your answer. This might often include a very short block of code demonstrating how to achieve the desired result.
The introduction is a courtesy to the rushed developer when it's possible to abbreviate the solution, although some answers aren't going to be simple or abbreviate-able, so don't sweat it if you can't summarize at the top.
The Body
Sometimes the longer explanation is separated by an HR, especially when the summary is duplicated within the longer-form answer (for example: this post). When the body contains mostly alternatives or advice, however, then you'd usually just add additional headers for each relevant topic. You can add "long-winded" answers/alternatives complete with references, cross-references, statistics, step-by-step repros, images of unicorns (only if relevant) and a rabbit-trail on spaces vs tabs (spaces, obviously... but again, only if relevant).
Your Approach So Far
I think the approach you've taken is fine. HRs aren't the easiest thing to see, so a rushed developer may miss it or not realize that the content above the HR is duplicated in the content below. Section headings are helpful for breaking up content, making it easier to read and follow, so I'd generally recommend you use them in the future (if you care to).
What really matters in the end, though, is the content, and grateful engineers won't hold formatting against you if you remove an obstacle from their path.
How-To
Personally, I don't like my headings to stand out too much, so I usually use H3 formatting:
### H3 Heading
H3 Heading
If you want to further organize content, then I'd recommend using H2 formatting for your major sections and H3 formatting for your minor sections. You can even use bold formatting to break up content within a minor section.
## Major Section
### Minor Section
**Sub-Section**
Major Section
Minor Section
Sub-Section
I've occasionally seen posts complex enough to require H1 formatting to properly organize content, but usually I see this used for "shouting" or making a really, really strong point.
# H1 Formatting (and/or shouting)
H1 Formatting (and/or shouting)
You can feel free to use the headings however you want, though. It's your post and if you'd rather use the H1's then by all means do so. I'd much rather see a solution to my problem then beautifully formatted nonsense.
Examples
See some example in practice: