IDing every descendent of a matrixfield Medium has a feature (that's likely the groundwork for their paragraph commenting, among other things) that adds an id to every tag inside of an article. Like so



I'm interested in replicating the behavior with Craft, in such a way that I can then write queries like element = craft.entries.find(2).element.find(120)
Each block within your Matrix field already has an ID, which you can access via block.id within a for-loop on your Matrix field:

{% for block in entry.myMatrixField %}
    ID: {{ block.id }}
{% endfor %}


If you want to be able to query directly for a specific Matrix block, you can use the Low Blocks plugin, which provides a craft.lowBlocks.id() function for accessing a block by its ID:

{% block = craft.lowBlocks.id(123) %}