📜  phoneto html (1)

📅  最后修改于: 2023-12-03 15:18:18.896000             🧑  作者: Mango

Phoneto HTML

Phoneto HTML is a simple and easy-to-use tool for converting phone numbers to clickable links in HTML format. It is especially useful for mobile devices where users can simply click on the phone number to make a call.

Features
  • Converts phone numbers to clickable links in HTML format.
  • Supports different phone number formats including international numbers.
  • Customizable link text and styles.
  • Easy integration into web applications.
Installation

Phoneto HTML is available on NPM:

npm install phoneto-html
Usage

To use Phoneto HTML, simply require and call the phonetoHtml function with the phone number as the argument:

const phonetoHtml = require('phoneto-html');

const html = phonetoHtml('123-456-7890');

console.log(html);
// Output: <a href="tel:123-456-7890">123-456-7890</a>

You can also provide additional options such as custom link text and styles:

const options = {
  text: 'Call us',
  style: {
    color: 'blue',
    textDecoration: 'underline',
  },
};

const html = phonetoHtml('123-456-7890', options);

console.log(html);
// Output: <a href="tel:123-456-7890" style="color:blue;text-decoration:underline;">Call us</a>

Phoneto HTML supports different phone number formats including international numbers:

const html = phonetoHtml('+1 123-456-7890');
// Output: <a href="tel:+11234567890">+1 123-456-7890</a>

const html = phonetoHtml('+44 1234 567890');
// Output: <a href="tel:+441234567890">+44 1234 567890</a>
Conclusion

Phoneto HTML is a simple and powerful tool for converting phone numbers to clickable links in HTML format. Its customizable options make it easy to integrate into web applications and provide a seamless user experience.