speechmarkdown / speechmarkdown-js

Speech Markdown grammar, parser, and formatters for use with JavaScript.
MIT License
76 stars 16 forks source link

Nested formatters break outside formatters #26

Closed RokasVaitkevicius closed 1 year ago

RokasVaitkevicius commented 5 years ago

There is a bug, when speech markdown formatters are nested in one another, only inside formatters get parsed, while outside formatters are left as a plain text. Example:

(break after this [0.2s] another break after this [0.2s])[rate:"slow"]

is parsed to:

break after this <break time="0.2s"/> another break after this <break time="0.2s"/>rate:"slow"

As you see prosody tag is not added and formatter stays too. If I remove breaks from the text:

(break after this another break after this)[rate:"slow"]

it resolves to

<prosody rate="slow">break after this another break after this</prosody>

When left alone, prosody works.

I tried putting other formatters, not only breaks inside formatters and they didn't work correctly either.

rmtuckerphx commented 5 years ago

For simplicity, the initial intention was to not support nesting. We can consider expanding the concept of sections to include additional (or maybe all) tags. Looking for feedback on this.

RokasVaitkevicius commented 5 years ago

@rmtuckerphx Overall, ssml supports nested tags, why speechmarkdown shouldn't? Also, what do you mean by 'simplicity'? Is it library coding simplicity or speechmarkdown syntax simplicity that you are concerned with?

rmtuckerphx commented 5 years ago

The primary users of speech markdown are content authors and designers and thirdly developers. Simplicity should always be framed with content authors in mind. It is true the SSML supports nesting. In some cases markdown also supports nesting, but it is towards markdown's simplicity that we should be leaning.

By allowing multiple tags in square braces, we remove the burden of nesting from the content author: ex: My favorite chemical element is (Al)[sub:"aluminum";volume:"x-loud";rate:"slow";pitch:"low"]

Seems like the only issue might be with breaks. Trying to weigh which one would be better from a content author's perspective: Option 1. (break after this [0.2s] another break after this [0.2s])[rate:"slow"] Option 2. (break after this)[rate:"slow"] [0.2s] (another break after this)[rate:"slow"][0.2s]

My perspective is that Option 2 is simpler for content authors. Would enjoy others to join in with their perspective.

tomhewitson commented 5 years ago

Hullo. As a content creator, option 1 feels more intuitive to me and I nest tags fairly frequently (IPA combined with prosody is another good example), maybe worth asking a few others who write a lot of ssml what they think too?

rmtuckerphx commented 5 years ago

@tomhewitson Thanks Tom for your feedback. You can already combine (which auto nests) IPA and prosody: speech markdown: I say, (pecan)[ipa:"ˈpi.kæn";rate:"x-slow"]. converts to SSML:

<speak>
I say, <prosody rate="x-slow"><phoneme alphabet="ipa" ph="ˈpi.kæn">pecan</phoneme></prosody>.
</speak>
rmtuckerphx commented 4 years ago

Looks like there is no further conversation on this topic. Thanks for a good discussion and thanks for your involvement in this project.

I am open to nesting. That way those who want to use it can and those who don't are covered as well. We need someone to write the tests and implement.

arjan commented 1 year ago

Closing issue due to no activity.