RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • addDependencyDetails
    • addEntityDetails
    • addLemmaDetails
    • addPartOfSpeechDetails
    • addSentenceDetails
    • addTypeDetails
    • bagOfNgrams
    • bagOfWords
    • cosineSimilarity
    • doc2sequence
    • encode
    • extractFileText
    • extractHTMLText
    • fastTextWordEmbedding
    • findElement
    • getAttribute
    • htmlTree
    • ind2word
    • isVocabularyWord
    • normalizeWords
    • readWordEmbedding
    • removeLongWords
    • removeShortWords
    • removeStopWords
    • removeWords
    • stopWords
    • tokenDetails
    • tokenizedDocument
    • trainWordEmbedding
    • vaderSentimentScores
    • vec2word
    • word2ind
    • word2vec
    • wordEncoding
    • writeWordEmbedding

htmlTree — Parse HTML code into a lightweight htmlTree object.

htmlTree(code) parses HTML text and returns an htmlTree object that can be passed to extractHTMLText. Scalar string and character-vector inputs produce a scalar object. String arrays, multi-row character arrays, and cell arrays of character vectors produce shaped cells containing htmlTree objects.

Syntax

tree = htmlTree(code)

Inputs

NameTypeRequiredDefaultDescription
codeAnyYes—HTML code or htmlTree object.

Returns

NameTypeDescription
treeAnyParsed HTML tree.

Errors

IdentifierWhenMessage
RunMat:html:InvalidInputInputs are not a supported htmlTree or extractHTMLText form.HTML Text Analytics helper received invalid input

How htmlTree works

  • code can be a string scalar, character vector, string array, multi-row character array, or cell array of character vectors.
  • The returned object stores Name, Children, Parent, Attributes, RawHTML, and Text properties.
  • Name is the uppercase root element name when an element is present.
  • Children is a column cell array of child htmlTree objects because RunMat does not yet have a first-class MATLAB object-array representation for this class.
  • Parent is <missing> at the root. Child objects store the parent element name rather than a cyclic object reference.
  • The parser accepts common well-formed and fragment HTML, skips comments and declarations, decodes common HTML entities, and preserves enough structure for text extraction, findElement, and getAttribute.
  • findElement and getAttribute support common selector and attribute workflows over RunMat htmlTree objects, including CSS tag/id/class selectors, attribute operator selectors, descendant/child/sibling combinators, selector groups, :empty, :first-child, :first-of-type, and simple :not(...) pseudo-class forms.
  • Full Text Analytics DOM parity remains incomplete: exact browser-grade malformed-HTML restructuring, cyclic parent object identity, MATLAB object-array identity semantics, and selector forms outside the documented RunMat subset remain tracked by the broader Text Analytics compatibility issue.

GPU memory and residency

htmlTree parses host-resident text and has no provider kernel.

Examples

Parse HTML

tree = htmlTree("<html><body><h1>Title</h1><p>Body</p></body></html>")

Expected output:

`tree` is an `htmlTree` object with `Name` equal to `"HTML"`.

Extract Text From Parsed HTML

tree = htmlTree("<article><h2>Title</h2><p>Body &amp; tail</p></article>");
str = extractHTMLText(tree)

Expected output:

str = "Title\n\nBody & tail"

Find Elements

tree = htmlTree("<div><a href='/docs'>Docs</a><p>Body</p></div>");
links = findElement(tree, "a");
href = getAttribute(links, "href")

Expected output:

href = "/docs"

Using htmlTree with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how htmlTree changes the result.

Run a small htmlTree example, explain the result, then change one input and compare the output.

FAQ

Does RunMat implement the full MATLAB htmlTree DOM surface?⌄

No. RunMat supports the core object representation, extractHTMLText, common findElement selectors, and getAttribute. Exact malformed-HTML restructuring, cyclic parent object identity, MATLAB object-array identity semantics, and selector forms outside the documented RunMat subset remain tracked in the Text Analytics umbrella issue.

Why is Children a cell array?⌄

RunMat's current generic object value does not yet model MATLAB object arrays for htmlTree, so children are stored as a cell array of scalar htmlTree objects.

Does htmlTree execute on the GPU?⌄

No. HTML parsing is host text processing and has no runmat-accelerate provider path.

Related Strings functions

Text Analytics

addDependencyDetails · addEntityDetails · addLemmaDetails · addPartOfSpeechDetails · addSentenceDetails · addTypeDetails · bagOfNgrams · bagOfWords · cosineSimilarity · doc2sequence · encode · extractFileText · extractHTMLText · fastTextWordEmbedding · findElement · getAttribute · ind2word · isVocabularyWord · normalizeWords · readWordEmbedding · removeLongWords · removeShortWords · removeStopWords · removeWords · stopWords · tokenDetails · tokenizedDocument · trainWordEmbedding · vaderSentimentScores · vec2word · word2ind · word2vec · wordEncoding · writeWordEmbedding

Transform

append · deblank · erase · eraseBetween · erasePunctuation · eraseURLs · extractAfter · extractBefore · extractBetween · insertAfter · insertBefore · join · lower · pad · replace · replaceBetween · reverse · split · splitlines · strcat · strip · strjoin · strjust · strrep · strsplit · strtrim · upper

Core

blanks · char · compose · convertCharsToStrings · convertContainedStringsToChars · convertStringsToChars · genvarname · int2str · isletter · isspace · isStringScalar · isstrprop · mat2str · native2unicode · newline · num2str · sprintf · sscanf · str2double · str2num · strcmp · strcmpi · string · string.empty · strings · strlength · strncmp · strncmpi · strtok · unicode2native

Search

contains · endsWith · matches · startsWith · strfind

Pattern

digitsPattern · lettersPattern · pattern · regexpPattern · textBoundary · wildcardPattern

Regex

regexp · regexpi · regexprep

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how htmlTree is executed, line by line, in Rust.

  • View the source for htmlTree in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How htmlTree works
  • GPU memory and residency
  • Examples
  • Parse HTML
  • Extract Text From Parsed HTML
  • Find Elements
  • Using htmlTree with coding agents
  • FAQ
  • Related Strings functions
  • Text Analytics
  • Transform
  • Core
  • Search
  • Pattern
  • Regex
  • Open-source implementation
  • About RunMat