Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your website is probably italicizing plant names wrong

Here is a plant name, formatted the way most websites do it: Hosta 'Blue Angel' And here it is formatted correctly: Hosta 'Blue Angel' The difference is small, but it's a rule. Botanical names follow two naming codes - the ICN for wild plants and the ICNCP for cultivated ones - and they are specific about typography: Italic: the genus, the species epithet and infraspecific epithets. Pinus mugo…

When it comes to botany, formatting plant names correctly is crucial. The correct format requires italicizing the genus, species epithet, and infraspecific epithets while using Roman (non-italic) text for rank markers, author citations, hybrid signs, cultivar groups, and cultivar names. Most websites, including PlantGeekz, incorrectly italicize the entire plant name, which is why the new "botanical-name" library was created.

This zero-dependency library, available for PHP and JavaScript/TypeScript, properly formats plant names by separating them into their individual parts, such as genus, epithet, authors, and cultivar groups. It also checks for common errors, such as apostrophes within cultivar names, capital X's inside names, and names enclosed in brackets.

The library ensures accuracy by comparing its output with 30,569 real names from PlantGeekz's taxonomy, guaranteeing that the cleaned names match the original ones exactly. The PHP and JavaScript/TypeScript implementations are kept identical through shared fixtures, line-by-line code porting, and differential testing.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Tuesday 15 September →