# How to get HTML that is fully equal to dom strucutre in editor?

**URL:** <https://discuss.prosemirror.net/t/how-to-get-html-that-is-fully-equal-to-dom-strucutre-in-editor/4720>\
**Category:** Uncategorized\
**Created:** [June 28, 2022, 2:46pm UTC](https://discuss.prosemirror.net/t/how-to-get-html-that-is-fully-equal-to-dom-strucutre-in-editor/4720 "2022-06-28T14:46:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saul-Mirone](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/saul-mirone/32/4160_2.png) [@Saul-Mirone](https://discuss.prosemirror.net/u/Saul-Mirone)\
**Post date:** [June 28, 2022, 2:46pm UTC](https://discuss.prosemirror.net/t/how-to-get-html-that-is-fully-equal-to-dom-strucutre-in-editor/4720/1 "2022-06-28T14:46:05Z")

</div>

I used to use `DOMSerializer` to get HTML that generated by prosemirror. But I found there’s some problems:

1. If dom is rendered by nodeView, the generated HTML will take value in `toDOM` which may have difference with dom generated in nodeView.
2. Sometimes there’re decorations in dom. Which is very common if we want to add highlight for codeblock using shiki or prism. `DOMSerializer` can’t keep the dom structure with decorations.

So, let’s say I’m using prosemirror as an blog editor. I want to save HTML that can be used to render blogs for users. What’s the recommand way to do this?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [June 28, 2022, 3:39pm UTC](https://discuss.prosemirror.net/t/how-to-get-html-that-is-fully-equal-to-dom-strucutre-in-editor/4720/2 "2022-06-28T15:39:55Z")

</div>

You could create an editor and take its `innerHTML`. Beyond than that, this isn’t something the editor provides.
