Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Text.HTMLtoStyledText

Converts HTML to styled text.

Component Version macOS Windows Linux Server iOS SDK
Text 15.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.HTMLtoStyledText"; HTML { ; Options } )   More

Parameters

Parameter Description Example Flags
HTML The html input.
Options The tidy options as JSON object. Optional

Result

Returns styled text or error.

Description

Converts HTML to styled text.
This uses tidy to parse the HTML and then convert the nodes to styled text for FileMaker.
This way you can preserve bold, italic and other styles as much as possible.
Does not read style definitions, but only inline styles.

Sets error log, which can be queried with Text.TidyErrorLog function.

For options, check this website:
https://api.html-tidy.org/tidy/tidylib_api_5.8.0/tidy_quickref.html

We support the following html tags:
  • B or STRONG for bold
  • I or EM for italic
  • U for underline
  • S for strikethrough
  • SUB for subscript
  • SUP for superscript
  • FONT with attributes for face, size and color. Color with # hex notation.
  • SPAN with CSS styles
  • UL and OL for lists with LI for elements.
  • BLOCKQUOTE and PRE for passing through text.
  • A for links where we print link in []
  • IMG for images where we print alt text and reference in []
  • H1 to H6 for headers with font size 14 to 24.

For CSS we do font-weight with bold, font-style with italic, text-decoration with underline and line-through, color with hex notation, font-size and font-family.

This is a limited implementation aimed to handle the output of our Markdown functions and to work without a Webviewer.

Examples

Convert HTML to styled text:

Set Field [ MarkDown::StyledText ; MBS("Text.HTMLtoStyledText"; MarkDown::HTML) ]
# show in webviewer to compare
Set Variable [ $r ; Value: MBS( "WebView.LoadHTML"; "web"; MarkDown::HTML ) ]

Convert markdown to styled text:

Set Variable [ $id ; Value: MBS("MarkDown.Create"; MarkDown::InputMarkDown) ]
If [ MBS("IsError") ]
    Show Custom Dialog [ $id ]
    Exit Script [ Text Result: ]
End If
Set Variable [ $html ; Value: MBS("MarkDown.HTML"; $id) ]
Set Variable [ $css ; Value: MBS("MarkDown.CSS"; $id) ]
Set Variable [ $r ; Value: MBS("MarkDown.Release"; $id) ]
Set Variable [ $htmldocument ; Value: "<html>" & ¶ & "<head>" & ¶ & $CSS & ¶ & "</head>" & ¶ & "<body>" & ¶ & $html & ¶ & "</body>" & ¶ & "</html>" ]
Set Field [ MarkDown::HTML ; $htmldocument ]
# now convert to styled text
Set Field [ MarkDown::StyledText ; MBS("Text.HTMLtoStyledText"; MarkDown::HTML) ]
# show in web viewer to compare
Set Variable [ $r ; Value: MBS( "WebView.LoadHTML"; "web"; MarkDown::HTML ) ]

Convert bold text:

MBS("Text.Styles"; MBS( "Text.HTMLtoStyledText"; "<b>bold</b>"))

Example result:
[ { "hasColor": false, "hasFont": false, "hasSize": false, "hasFace": true, "face": 256, "bold": true, "italic": false, "underline": false, "outline": false, "shadow": false, "condense": false, "extend": false, "strikethrough": false, "smallCaps": false, "superscript": false, "subscript": false, "wordUnderline": false, "doubleUnderline": false, "text": "bold", "start": 1 } ]

See also

Release notes

  • Version 15.5
    • Improved Text.HTMLtoStyledText function to handle underline and strikethrough better.
    • Added Text.HTMLtoStyledText function.
    • Implemented WebView.GetFormattedText for Windows using Text.HTMLtoStyledText internally.
    • Added MarkDown.StyledText using Text.HTMLtoStyledText to convert HTML to styled text.

Blog Entries

Created 11st October 2025, last changed 15th October 2025


Text.HTMLtoJSON - Text.IdentifyData