Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

HTMLFragment (.html)

BackgroundBackground

    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.

Import and ExportImport and Export

OptionsOptions

  • $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

ExamplesExamplesopen allclose all

Basic Examples  (6)Basic Examples  (6)

Translate an expression to an HTML fragment:

In[1]:=
Click for copyable input
Out[1]=

Specify a "URLHandler" for the export process:

In[2]:=
Click for copyable input
Out[2]=

Deploy the temporary data with a custom function:

In[3]:=
Click for copyable input
In[4]:=
Click for copyable input
Out[4]=

Export the temporary data to a directory and map with a URL:

In[5]:=
Click for copyable input
Out[5]=

Generate an HTML fragment with a "Bootstrap" class:

In[1]:=
Click for copyable input
Out[1]=

Generate an HTML fragment for a string containing any characters:

In[1]:=
Click for copyable input
Out[1]=

Generate a full HTML document:

In[1]:=
Click for copyable input
Out[1]//Short=

Apply a custom function:

In[2]:=
Click for copyable input
Out[2]=

Apply a custom template:

In[3]:=
Click for copyable input
In[4]:=
Click for copyable input
Out[4]=

Create a formatted HTML page using "TemplateEnvironment":

In[5]:=
Click for copyable input

Create an HTML form that submits to an external web page using "TemplateEnvironment":

In[6]:=
Click for copyable input

Specify an "XMLTransformationFunction" to apply:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Specify how to format graphics:

In[1]:=
Click for copyable input
Out[1]//Short=

Specify how to format audio:

In[2]:=
Click for copyable input
Out[2]//Short=

Output math expressions as "MathML":

In[3]:=
Click for copyable input
Out[3]//Short=

Customize how dates are transformed:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
In[6]:=
Click for copyable input
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=

Specify how to format numbers with a list of rules:

In[9]:=
Click for copyable input
Out[9]=

Provide a Wolfram Language function to format numbers:

In[10]:=
Click for copyable input
Out[10]=

Use a custom function to format numbers:

In[11]:=
Click for copyable input
Out[11]=
Introduced in 2014
(10.0)