Hi! The short answer to your question is “yes”. It sounds like you’re using the Insert Live Sample Code Template button in the editor UI. You can also insert a live sample macro by typing it manually:
{{EmbedLiveSample(block_ID, width, height, screenshot_URL, page_slug)}}
The “block_ID” parameter can be the ID of any enclosing block or heading. For example, if the existing code sample is under a heading “Foo Example”, then you can use “Foo_Example” as the block_ID parameter. (On MDN, a heading element’s “title” value is automatically used as the “id” attribute, with spaces converted to underscores.)
The other parameters are optional, and use default values if you don’t specify them.
That was the short answer. The long answer is that we actually have multiple ways of displaying code samples. In addition to “static” and “live” examples, we also can have “live” examples that are stored on Github (and therefore can be more easily reused in multiple places), and interactive examples that readers can actually modify and play with. Interactive examples are currently only possible on CSS and JavaScript reference pages; they also are stored on Github. The various types of code examples are all described in excruciating detail in the Code Examples article. However, if you just want to convert some existing static examples to be “live”, you can ignore the Github-based example types.