HTMLFragment (.html)

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

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"Automatichow to format dates
    "FilesDirectory"Automaticfile directory for the export
    "FilesPrefix"AutomaticURL to return for the export
    "FullDocument"Automaticwhether 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"Automatichow to represent number expressions
    "RenderFormat""HTML"format to use during rendering
    "StaticPrefix"AutomaticURL to return if on a webserver
    "StaticRoot"Automaticreal path on disk
    "TemplateEnvironment"<||>environment to use when the "TemplateFunction" is applied
    "TemplateFunction"Automaticfunction or XMLTemplate to use during the export process
    "URIHandler""DataURI"how to represent generated URLs
    "XMLTransformationFunction"NoneXML 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 TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X, 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:
  • Automaticconverts 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
    funcconverts 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:

Apply a custom function:

Apply a custom template:

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:

Specify how to format audio:

Output math expressions as "MathML":

Customize how dates are transformed:

Specify how to format numbers with a list of rules:

Provide a Wolfram Language function to format numbers:

Use a custom function to format numbers: