Gutenberg add extra attributes to custom format

I was able to add the attribute by passing it in attributes through the registerFormatType settings:

attributes: {
   'custom-attr': 'custom-attr'
},

then in edit():

toggleFormat( value, {
    attributes: {
      'custom-attr': 'Hello world'
    },
} )

I don’t know how exactly it all works together because I could not find detailed explanations in the current documentation.

Another great feature would be the ability to add extra HTML markup in custom formats but I could not find any examples. For example:

<div custom-attr="Hello world"><div class="an-extra-div"></div>Lorem ipsum dolor...</div>

deneme bonusu veren sitelerbahis siteleripulibet girişdeneme bonusutürkçe altyazılı pornocanlı bahis casinocanlı bahis casino siteleriOnwin Güncel Girişholiganbetholiganbet girişholiganbet güncel girişnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnews