HTMLFragment (.html)
- "HTMLFragment" is supported by Export and ExportString only.
- Output from Export[…,"HTMLFragment"] and ExportString[…,"HTMLFragment"] conform to the XHTML 1.1 standard.
Background & Context
-
- Registered MIME type: text/html
- HTML markup language and file format.
- Predominant language for the creation of web pages.
- HTML is an acronym derived from Hypertext Markup Language.
- Plain text format.
- Describes the structure and aspects of the appearance of web pages.
- First published in 1993 as an Internet Engineering Task Force (IETF) working draft.
- Maintained since 1996 by the World Wide Web Consortium (W3C).
- Most recent version is 4.01, published in 1999 as W3C recommendation.
- International standard ISO/IEC 15445:2000.
- Predecessor of XHTML.
Export
- Export["file.html",expr,"HTMLFragment"] or ExportString[expr,"HTMLFragment"] creates HTML fragment versions of expr.
- See the following reference pages for full general information:
-
Export export to a file CloudExport export to a cloud object ExportString export to a string ExportByteArray export to a byte array
Options
- $HTMLExportRules is a list of rules containing the export options and values.
- "HTMLFragment" automatically translates all characters into HTML entities.
- Export options:
-
"AudioOutput" "FLAC" how to represent audio expressions "DateFormat" Automatic how to format dates "FilesDirectory" Automatic file directory for the export "FilesPrefix" Automatic URL to return for the export "FullDocument" Automatic whether to export a complete HTML document "Graphics3DOutput" "PNG" how to represent 3D graphics expressions "GraphicsOutput" "SVG" how to represent graphics expressions "ImageOutput" "PNG" how to represent image expressions "MathOutput" "PNG" how to represent typeset expressions "NumericOutput" Automatic how to represent number expressions "RenderFormat" "HTML" format to use during rendering "StaticPrefix" Automatic URL to return if on a webserver "StaticRoot" Automatic real path on disk "TemplateEnvironment" < > environment to use when the "TemplateFunction" is applied "TemplateFunction" Automatic function or XMLTemplate to use during the export process "URIHandler" "DataURI" how to represent generated URLs "XMLTransformationFunction" None XML transformation function to apply before transformation - "AudioOutput" will convert to any of the built-in "Audio Formats".
- "DateFormat" can be a format or a function.
- Possible settings for "GraphicsOutput", "Graphics3DOutput", and "MathOutput" are:
-
"CDF" converts the targeted expressions to embedded CDF "DisplayForm" converts the targeted expressions to ASCII approximations of their appearance "GIF" converts the targeted expressions to GIF "InputForm" converts the targeted expressions to their InputForm "PNG" converts the targeted expressions to PNG "JPEG" converts the targeted expressions to JPEG "SVG" converts the targeted expressions to SVG - "MathOutput"->"MathML" or "MathOutput"->"TeX" will convert all typeset expressions to MathML or , respectively. JavaScript will also be added if "FullDocument" -> True.
- "NumericFormat" can be a list of rules or a function.
- Possible settings for "RenderFormat" are:
-
"HTML" render as HTML "Bootstrap" render as HTML with embedded "Bootstrap" classes - On a web server, files are deployed into "StaticRoot" and mapped with "StaticPrefix".
- Possible settings for "URLHandler" are:
-
Automatic converts generated URLs to data URIs if the data is sufficiently small, otherwise exporting to temporary files on disk "CloudPut" converts generated URLs to data CloudObjects "DataURI" converts generated URLs to data URIs "Export" converts generated URLs to temporary files on disk func converts generated URLs using func
Examples
Basic Examples (6)
Translate an expression to an HTML fragment:
Specify a "URLHandler" for the export process:
Deploy the temporary data with a custom function:
Export the temporary data to a directory and map with a URL:
Generate an HTML fragment with a "Bootstrap" class:
Generate an HTML fragment for a string containing any characters:
Generate a full HTML document:
Create a formatted HTML page using "TemplateEnvironment":
Create an HTML form that submits to an external web page using "TemplateEnvironment":
Specify an "XMLTransformationFunction" to apply:
Specify how to format graphics:
Output math expressions as "MathML":
Customize how dates are transformed:
Specify how to format numbers with a list of rules: