crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

Returned markdown missing formatting and links

Open chanmathew opened this issue 4 months ago • 7 comments

Hi @unclecode - First of all thanks for your amazing work on this lib! It's exciting to have an open source crawler that works quite well!

I was testing switching over from a paid provider, however I'm noticing some differences in the markdown output, where it seems to retain less of the actual formatting, which affects our downstream processing (feeding to an LLM for extraction). Due to the stripped formatting, we're finding that the LLM tends to yield worse results because it's losing those subtle cues.

For example take this section about Guadalajara, Mexico from this page: https://janineintheworld.com/places-to-visit-in-central-mexico

Here's the extracted MD from other provider: ### 1. Guadalajara, Jalisco\nGuadalajara is a vibrant city that beautifully blends tradition with modernity, making it a must-visit destination. As the second-largest city in Mexico and the epicenter of the country’s tech scene, it offers a dynamic and exciting atmosphere.\n![Guadalajara's Catedral de la Asunción de María Santísima, with a flock of pigeons taking flight in the foreground](https://www.janineintheworld.com/wp-content/uploads/2024/01/guadalajara_Catedral-de-la-Asuncion-de-Maria-Santisima.jpg)*Guadalajara’s Catedral de la Asunción de María Santísima is an emblematic landmark of the city.*\nDive into the cultural richness by visiting the Mercado San Juan de Dios, the largest market in Latin America. Even if you’re not looking to buy anything, it’s cool to wander through and take in the expanse of it all. The market is also a great place to try some traditional Jaliscense food, like*tortas ahogadas*or*tacos de birria\*!\nNature lovers will adore the Bosque de Colomos, a vast nature park that provides a peaceful escape from the urban buzz. Wander through the Japanese garden, jog along the plentiful paths, or take a book and lay out on the grass for the afternoon!\nFor a shopping adventure, the colorful neighborhood of Tlaquepaque is the place to be, with its endless array of artisanías offering a true taste of Mexican craftsmanship. You can pick up all kinds of gorgeous pottery, textiles, and blown glass goods here.\nGuadalajara also happens to be the birthplace of Mariachi music and a hub for tequila production. There are lots of venues throughout the city to catch a performance. The[**Plaza de los Mariachis**](https://www.tripadvisor.es/Attraction_Review-g150798-d155222-Reviews-Plaza_de_los_Mariachis-Guadalajara_Guadalajara_Metropolitan_Area.html)and[**Restaurante El Patio**](https://www.elpatio.com.mx/)(in Tlaquepaque) are great places to start!

Here's what's extracted from crawl4ai:

### 1\\. Guadalajara, Jalisco\n\nGuadalajara is a vibrant city that beautifully blends tradition with modernity, making it a must-visit destination. As the second-largest city in Mexico and the epicenter of the country’s tech scene, it offers a dynamic and exciting atmosphere. \n\n![Guadalajara's Catedral de la Asunción de María Santísima, with a flock of pigeons taking flight in the foreground](https://www.janineintheworld.com/wp-content/uploads/2024/01/guadalajara_Catedral-de-la-Asuncion-de-Maria-Santisima.jpg)\n\nGuadalajara’s Catedral de la Asunción de María Santísima is an emblematic landmark of the city.\n\nDive into the cultural richness by visiting the Mercado San Juan de Dios, the largest market in Latin America. Even if you’re not looking to buy anything, it’s cool to wander through and take in the expanse of it all. The market is also a great place to try some traditional Jaliscense food, like tortas ahogadas or tacos de birria! \n\nNature lovers will adore the Bosque de Colomos, a vast nature park that provides a peaceful escape from the urban buzz. Wander through the Japanese garden, jog along the plentiful paths, or take a book and lay out on the grass for the afternoon!\n\nFor a shopping adventure, the colorful neighborhood of Tlaquepaque is the place to be, with its endless array of artisanías offering a true taste of Mexican craftsmanship. You can pick up all kinds of gorgeous pottery, textiles, and blown glass goods here. \n\nGuadalajara also happens to be the birthplace of Mariachi music and a hub for tequila production. There are lots of venues throughout the city to catch a performance. The Plaza de los Mariachis and Restaurante El Patio (in Tlaquepaque) are great places to start!

You can see in the crawl4ai version, there are some differences / issues:

  1. The numbering seems to always be escaped \ when it doesn't need to be
  2. Guadalajara’s Catedral de la Asunción is missing the * asterisk in front of it
  3. Bolds and italic formatting are stripped (see tortas ahogadas, or [Plaza de los Mariachis]
  4. Links are missing from the markdown, see the tripadvisor link and the elpatio link (which seems like there's another issue opened already #173) - This is important to keep the exact position of the links as found in the original content, as the placement is important for us to infer relationships for downstream processing

Would it be possible to address the above so that the markdown returned is as true to the actual HTML / original content as possible? Hope that's helpful, thank you!

chanmathew avatar Oct 20 '24 03:10 chanmathew