Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
ts-ssml-builder
Advanced tools
Readme
Speech Synthesis Markup Language (SSML) is an XML-based markup language for speech synthesis applications.
This library supports the creation of SSML.
npm install ts-ssml-builder
import { SSMLBuilder } from 'ts-ssml-builder';
const builder = new SSMLBuilder();
const ssml = builder
.paragraph()
.raw('This is sample')
.break({ time: '10s' })
.audio( {src: 'audio.mp4' } )
.up()
.up()
.ssml();
console.log( ssml )
/**
* Output: String
* <speak><p >This is sample<break time="10s" /><audio src="audio.mp4"></audio></p></speak>
*/
interface ISsmlBuilder {
ssml(): string;
raw( value: string, useEscape?: boolean ): Builder;
sayAs( option: interfaces.ISayAs ): Builder;
break( option?: Partial<interfaces.IBreak> ): Builder;
sub( option: interfaces.ISub ): Builder;
audio( option: interfaces.IAudio ): Builder; // Wrap tag
sentence(): Builder; // Wrap tag
paragraph(): Builder; // Wrap tag
prosody( option: interfaces.IProsody ): Builder;
emphasis( option?: interfaces.IEmphasis ): Builder; // Wrap tag
up(): Builder;
};
export class Builder implements ISsmlBuilder { /** */}
Wrap tag( sentence, paragraph... ) needs to explicitly call up()
when closing a tag.
Name | Wrap tag? | Description |
---|---|---|
raw | No | You can add text and insert custom tags. useEscape is default true . |
sayAs | No | Insert the say-as tag. |
break | No | Insert the break tag. |
sub | No | Insert the sub tag. |
audio | Yes | Insert the audio tag. |
sentence | Yes | Insert the s tag. |
paragraph | Yes | Insert the p tag. |
prosody | No | Insert the prosody tag. |
emphasis | Yes | Insert the emphasis tag. |
The audio
and prosody
can be set to any attribute.
type InterpretAs = 'characters' | 'spell-out' | 'cardinal' | 'number' | 'address'
| 'ordinal' | 'digits' | 'fraction' | 'unit' | 'date' | 'time' | 'telephone'
| 'interjection' | 'expletive'
interface ISayAs {
interpretAs: InterpretAs;
word: string;
format?: string;
detail?: string;
};
type BreakStrength = 'none' | 'x-weak' | 'weak' | 'medium' | 'strong' | 'x-strong'
interface IBreak {
strength: BreakStrength;
time: string;
};
interface ISub {
alias: string;
word: string;
};
interface IAudio {
src: string;
[ key: string ] : string;
};
interface IProsody {
word: string;
[ key: string ] : string;
};
export type EmphasisLevel = 'strong' | 'moderate' | 'none' | 'reduced'
export interface IEmphasis {
level: EmphasisLevel;
};
Applies to all word
values of the above API parameters and when useEscape
of API:raw
is true
.
Therefore, if you use custom elements in raw, useEscape
should be set to false
.
/* Escape processing */
escapedLines = escapedLines.replace(/&/g, '&');
escapedLines = escapedLines.replace(/"/g, '"');
escapedLines = escapedLines.replace(/</g, '<');
escapedLines = escapedLines.replace(/>/g, '>');
FAQs
## Description Speech Synthesis Markup Language (SSML) is an XML-based markup language for speech synthesis applications.
The npm package ts-ssml-builder receives a total of 1 weekly downloads. As such, ts-ssml-builder popularity was classified as not popular.
We found that ts-ssml-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.