Convert content to Portable Text with AI
Migrate a representative article from HTML or Markdown and inspect its headings, annotations and nested lists before converting a whole archive.
Convert content to Portable Text with AI using the most awkward article in your archive, not the shortest. A heading, a nested list and a linked phrase will reveal more about the conversion than five plain paragraphs.
The portable-text-conversion instructions cover separate paths for Markdown and HTML, alongside constructing blocks directly. For an old site with a distinctive callout box, the useful decision is whether the destination schema has a matching block or should preserve it as ordinary text.
What it does
- Map article headings to block styles.
- Keep link text associated with the right destination.
- Check indentation in a multi-level list.
- Choose a conversion rule for a custom callout.
- Identify image references that need separate asset handling.
Install and use
- Provide Node.js, the official Portable Text package for the chosen source format and a representative document. Local conversion needs no Sanity account; writing to a hosted dataset is separate.
- Try: “Convert this HTML article locally. Show me the output for the linked phrase and the nested list before processing another file.”
- Compare the converted structure with the source and render a sample. Verify that any image references point to assets that exist in the destination.
FAQ
Source
Made by Sanity. Original skill: portable-text-conversion, published on GitHub under the MIT licence.
View on GitHub