HTML Tidy  5.9.15
The HTACG Tidy HTML Project
tidy.h File Reference

Detailed Description

Defines HTML Tidy public API implemented by LibTidy.

This public interface provides the entire public API for LibTidy, and is the sole interface that you should use when implementing LibTidy in your own applications.

See tidy.c as an example application implementing the public API.

This API is const-correct and doesn't explicitly depend on any globals. Thus, thread-safety may be introduced without changing the interface.

The API limits all exposure to internal structures and provides only accessors that return simple types such as C strings and integers, which makes it quite suitable for integration with any number of other languages.

Author
Dave Raggett [dsr@w.nosp@m.3.or.nosp@m.g]
HTACG, et al (consult git log)
Remarks
The contributing author(s) would like to thank all those who helped with testing, bug fixes and suggestions for improvements. This wouldn't have been possible without your help.
All Rights Reserved.
This software and documentation is provided "as is," and the copyright holders and contributing author(s) make no representations or warranties, express or implied, including but not limited to, warranties of merchantability or fitness for any particular purpose or that the use of the software or documentation will not infringe any third party patents, copyrights, trademarks or other rights.
The copyright holders and contributing author(s) will not be held liable for any direct, indirect, special or consequential damages arising out of any use of the software or documentation, even if advised of the possibility of such damage.
Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, documentation and executables, for any purpose, without fee, subject to the following restrictions:
  1. The origin of this source code must not be misrepresented.
  2. Altered versions must be plainly marked as such and must not be misrepresented as being the original source.
  3. This Copyright notice may not be removed or altered from any source or altered source distribution.
The copyright holders and contributing author(s) specifically permit, without fee, and encourage the use of this source code as a component for supporting the Hypertext Markup Language in commercial products. If you use this source code in a product, acknowledgment is not required but would be appreciated.
Date
Created 2001-05-20 by Charles Reitzel
Updated 2002-07-01 by Charles Reitzel - 1st Implementation
Updated 2015-06-09 by Geoff R. McLane - Add more doxygen syntax
Additional updates: consult git log

Go to the source code of this file.

Data Structures

struct  TidyAllocator
 Tidy's built-in default allocator. More...
 
struct  TidyAllocatorVtbl
 This structure is the function table for an allocator. More...
 
struct  TidyInputSource
 This type defines an input source capable of delivering raw bytes of input. More...
 
struct  TidyOutputSink
 This type defines an output destination capable of accepting raw bytes of output. More...
 

Typedefs

typedef void(TIDY_CALLTidyFree) (void *buf)
 Callback for free replacement. More...
 
typedef void *(TIDY_CALLTidyMalloc) (size_t len)
 Callback for malloc replacement. More...
 
typedef void(TIDY_CALLTidyPanic) (ctmbstr mssg)
 Callback for out of memory panic state. More...
 
typedef void *(TIDY_CALLTidyRealloc) (void *buf, size_t len)
 Callback for realloc replacement. More...
 

Functions

TidyIterator TIDY_CALL getErrorCodeList (void)
 Initiates an iterator for a list of message codes available in Tidy. More...
 
uint TIDY_CALL getNextErrorCode (TidyIterator *iter)
 Given a valid TidyIterator initiated with getErrorCodeList(), returns an instance of the opaque type TidyMessageArgument, which serves as a token against which the remaining argument API functions may be used to query information. More...
 
int TIDY_CALL tidyCleanAndRepair (TidyDoc tdoc)
 Execute configured cleanup and repair operations on parsed markup. More...
 
ctmbstr TIDY_CALL tidyErrorCodeAsKey (uint code)
 Given a message code, return the text key that represents it. More...
 
uint TIDY_CALL tidyErrorCodeFromKey (ctmbstr code)
 Given a text key representing a message code, return the uint that represents it. More...
 
int TIDY_CALL tidyOptSaveFile (TidyDoc tdoc, ctmbstr cfgfil)
 Save current settings to named file. More...
 
int TIDY_CALL tidyOptSaveSink (TidyDoc tdoc, TidyOutputSink *sink)
 Save current settings to given output sink. More...
 
int TIDY_CALL tidyParseBuffer (TidyDoc tdoc, TidyBuffer *buf)
 Parse markup in given buffer. More...
 
int TIDY_CALL tidyParseFile (TidyDoc tdoc, ctmbstr filename)
 Parse markup in named file. More...
 
int TIDY_CALL tidyParseSource (TidyDoc tdoc, TidyInputSource *source)
 Parse markup in given generic input source. More...
 
int TIDY_CALL tidyParseStdin (TidyDoc tdoc)
 Parse markup from the standard input. More...
 
int TIDY_CALL tidyParseString (TidyDoc tdoc, ctmbstr content)
 Parse markup in given string. More...
 
int TIDY_CALL tidyReportDoctype (TidyDoc tdoc)
 Reports the document type into the output sink. More...
 
int TIDY_CALL tidyRunDiagnostics (TidyDoc tdoc)
 Reports the document type and diagnostic statistics on parsed and repaired markup. More...
 
int TIDY_CALL tidySaveBuffer (TidyDoc tdoc, TidyBuffer *buf)
 Save the tidy document to given TidyBuffer object. More...
 
int TIDY_CALL tidySaveFile (TidyDoc tdoc, ctmbstr filename)
 Save the tidy document to the named file. More...
 
int TIDY_CALL tidySaveSink (TidyDoc tdoc, TidyOutputSink *sink)
 Save to given generic output sink. More...
 
int TIDY_CALL tidySaveStdout (TidyDoc tdoc)
 Save the tidy document to standard output (FILE*). More...
 
int TIDY_CALL tidySaveString (TidyDoc tdoc, tmbstr buffer, uint *buflen)
 Save the tidy document to an application buffer. More...
 
Bool TIDY_CALL tidySetFreeCall (TidyFree ffree)
 Give Tidy a free() replacement. More...
 
Bool TIDY_CALL tidySetMallocCall (TidyMalloc fmalloc)
 Give Tidy a malloc() replacement. More...
 
Bool TIDY_CALL tidySetPanicCall (TidyPanic fpanic)
 Give Tidy an "out of memory" handler. More...
 
Bool TIDY_CALL tidySetReallocCall (TidyRealloc frealloc)
 Give Tidy a realloc() replacement. More...
 
Instantiation and Destruction
TidyDoc TIDY_CALL tidyCreate (void)
 The primary creation of a document instance. More...
 
TidyDoc TIDY_CALL tidyCreateWithAllocator (TidyAllocator *allocator)
 Create a document supplying your own, custom TidyAllocator instead of using the built-in default. More...
 
void TIDY_CALL tidyRelease (TidyDoc tdoc)
 Free all memory and release the TidyDoc. More...
 
Host Application Data
void *TIDY_CALL tidyGetAppData (TidyDoc tdoc)
 Returns the data previously stored with tidySetAppData(). More...
 
void TIDY_CALL tidySetAppData (TidyDoc tdoc, void *appData)
 Allows the host application to store a chunk of data with each TidyDoc instance. More...
 
LibTidy Version Information
ctmbstr TIDY_CALL tidyLibraryVersion (void)
 Get the version number for the current library. More...
 
ctmbstr TIDY_CALL tidyPlatform (void)
 Get the platform for which Tidy was built. More...
 
ctmbstr TIDY_CALL tidyReleaseDate (void)
 Get the release date for the current library. More...
 
Diagnostics and Repair
uint TIDY_CALL tidyAccessWarningCount (TidyDoc tdoc)
 Indicates the number of TidyAccess messages that were generated. More...
 
uint TIDY_CALL tidyConfigErrorCount (TidyDoc tdoc)
 Indicates the number of configuration error messages that were generated. More...
 
Bool TIDY_CALL tidyDetectedGenericXml (TidyDoc tdoc)
 Indicates whether or not the input document was XML. More...
 
int TIDY_CALL tidyDetectedHtmlVersion (TidyDoc tdoc)
 Gets the version of HTML that was output, as an integer, times 100. More...
 
Bool TIDY_CALL tidyDetectedXhtml (TidyDoc tdoc)
 Indicates whether the output document is or isn't XHTML. More...
 
uint TIDY_CALL tidyErrorCount (TidyDoc tdoc)
 Indicates the number of TidyError messages that were generated. More...
 
void TIDY_CALL tidyErrorSummary (TidyDoc tdoc)
 Write more complete information about errors to current error sink. More...
 
void TIDY_CALL tidyGeneralInfo (TidyDoc tdoc)
 Write more general information about markup to current error sink. More...
 
int TIDY_CALL tidyStatus (TidyDoc tdoc)
 Get status of current document. More...
 
uint TIDY_CALL tidyWarningCount (TidyDoc tdoc)
 Indicates the number of TidyWarning messages that were generated. More...
 
Configuration, File, and Encoding Operations
Bool TIDY_CALL tidyFileExists (TidyDoc tdoc, ctmbstr filename)
 Determine whether or not a particular file exists. More...
 
int TIDY_CALL tidyLoadConfig (TidyDoc tdoc, ctmbstr configFile)
 Load an ASCII Tidy configuration file and set the configuration per its contents. More...
 
int TIDY_CALL tidyLoadConfigEnc (TidyDoc tdoc, ctmbstr configFile, ctmbstr charenc)
 Load a Tidy configuration file with the specified character encoding, and set the configuration per its contents. More...
 
int TIDY_CALL tidySetCharEncoding (TidyDoc tdoc, ctmbstr encnam)
 Set the input/output character encoding for parsing markup. More...
 
int TIDY_CALL tidySetInCharEncoding (TidyDoc tdoc, ctmbstr encnam)
 Set the input encoding for parsing markup. More...
 
int TIDY_CALL tidySetOutCharEncoding (TidyDoc tdoc, ctmbstr encnam)
 Set the input encoding for writing markup. More...
 
Option ID Discovery
TidyOptionId TIDY_CALL tidyOptGetId (TidyOption opt)
 Get ID of given Option. More...
 
TidyOptionId TIDY_CALL tidyOptGetIdForName (ctmbstr optnam)
 Returns the TidyOptionId (enum value) by providing the name of a Tidy configuration option. More...
 
Getting Instances of Tidy Options
TidyOption TIDY_CALL tidyGetNextOption (TidyDoc tdoc, TidyIterator *pos)
 Given a valid TidyIterator initiated with tidyGetOptionList(), returns the instance of the next TidyOption. More...
 
TidyOption TIDY_CALL tidyGetOption (TidyDoc tdoc, TidyOptionId optId)
 Retrieves an instance of TidyOption given a valid TidyOptionId. More...
 
TidyOption TIDY_CALL tidyGetOptionByName (TidyDoc tdoc, ctmbstr optnam)
 Returns an instance of TidyOption by providing the name of a Tidy configuration option. More...
 
TidyIterator TIDY_CALL tidyGetOptionList (TidyDoc tdoc)
 Initiates an iterator for a list of TidyOption instances, which allows you to iterate through all of the available options. More...
 
Information About Options
TidyConfigCategory TIDY_CALL tidyOptGetCategory (TidyOption opt)
 Get category of given Option. More...
 
ctmbstr TIDY_CALL tidyOptGetDefault (TidyOption opt)
 Get default value of given Option as a string. More...
 
Bool TIDY_CALL tidyOptGetDefaultBool (TidyOption opt)
 Get default value of given Option as a Boolean value. More...
 
ulong TIDY_CALL tidyOptGetDefaultInt (TidyOption opt)
 Get default value of given Option as an unsigned integer. More...
 
ctmbstr TIDY_CALL tidyOptGetName (TidyOption opt)
 Get name of given Option. More...
 
ctmbstr TIDY_CALL tidyOptGetNextPick (TidyOption opt, TidyIterator *pos)
 Given a valid TidyIterator initiated with tidyOptGetPickList(), returns a string representing a possible option value. More...
 
TidyIterator TIDY_CALL tidyOptGetPickList (TidyOption opt)
 Initiates an iterator for a list of TidyOption pick-list values, which allows you iterate through all of the available option values. More...
 
TidyOptionType TIDY_CALL tidyOptGetType (TidyOption opt)
 Get datatype of given Option. More...
 
Bool TIDY_CALL tidyOptionIsList (TidyOption opt)
 Indicates that an option takes a list of items. More...
 
Bool TIDY_CALL tidyOptIsReadOnly (TidyOption opt)
 Is Option read-only? Some options (mainly internal use only options) are read-only. More...
 
Option Value Functions
Bool TIDY_CALL tidyOptCopyConfig (TidyDoc tdocTo, TidyDoc tdocFrom)
 Copy current configuration settings from one document to another. More...
 
Bool TIDY_CALL tidyOptDiffThanDefault (TidyDoc tdoc)
 Any settings different than default? More...
 
Bool TIDY_CALL tidyOptDiffThanSnapshot (TidyDoc tdoc)
 Any settings different than snapshot? More...
 
Bool TIDY_CALL tidyOptGetBool (TidyDoc tdoc, TidyOptionId optId)
 Get current option value as a Boolean flag. More...
 
ctmbstr TIDY_CALL tidyOptGetCurrPick (TidyDoc tdoc, TidyOptionId optId)
 Get the current pick list value for the option ID, which can be useful for enum types. More...
 
TidyIterator TIDY_CALL tidyOptGetDeclTagList (TidyDoc tdoc)
 Initiates an iterator for a list of user-declared tags, including autonomous custom tags detected in the document if TidyUseCustomTags is not set to no. More...
 
ctmbstr TIDY_CALL tidyOptGetEncName (TidyDoc tdoc, TidyOptionId optId)
 Get character encoding name. More...
 
ulong TIDY_CALL tidyOptGetInt (TidyDoc tdoc, TidyOptionId optId)
 Get current option value as an integer. More...
 
TidyIterator TIDY_CALL tidyOptGetMutedMessageList (TidyDoc tdoc)
 Initiates an iterator for a list of muted messages. More...
 
ctmbstr TIDY_CALL tidyOptGetNextDeclTag (TidyDoc tdoc, TidyOptionId optId, TidyIterator *iter)
 Given a valid TidyIterator initiated with tidyOptGetDeclTagList(), returns a string representing a user-declared or autonomous custom tag. More...
 
ctmbstr TIDY_CALL tidyOptGetNextMutedMessage (TidyDoc tdoc, TidyIterator *iter)
 Given a valid TidyIterator initiated with tidyOptGetMutedMessageList(), returns a string representing a muted message. More...
 
ctmbstr TIDY_CALL tidyOptGetNextPriorityAttr (TidyDoc tdoc, TidyIterator *iter)
 Given a valid TidyIterator initiated with tidyOptGetPriorityAttrList(), returns a string representing a priority attribute. More...
 
TidyIterator TIDY_CALL tidyOptGetPriorityAttrList (TidyDoc tdoc)
 Initiates an iterator for a list of priority attributes. More...
 
ctmbstr TIDY_CALL tidyOptGetValue (TidyDoc tdoc, TidyOptionId optId)
 Get the current value of the option ID for the given document. More...
 
Bool TIDY_CALL tidyOptParseValue (TidyDoc tdoc, ctmbstr optnam, ctmbstr val)
 Set named option value as a string, regardless of the TidyOptionType. More...
 
Bool TIDY_CALL tidyOptResetAllToDefault (TidyDoc tdoc)
 Reset all options to their default values. More...
 
Bool TIDY_CALL tidyOptResetToDefault (TidyDoc tdoc, TidyOptionId opt)
 Reset option to default value by ID. More...
 
Bool TIDY_CALL tidyOptResetToSnapshot (TidyDoc tdoc)
 Apply a snapshot of config settings to a document. More...
 
Bool TIDY_CALL tidyOptSetBool (TidyDoc tdoc, TidyOptionId optId, Bool val)
 Set option value as a Boolean flag. More...
 
Bool TIDY_CALL tidyOptSetInt (TidyDoc tdoc, TidyOptionId optId, ulong val)
 Set option value as an integer. More...
 
Bool TIDY_CALL tidyOptSetValue (TidyDoc tdoc, TidyOptionId optId, ctmbstr val)
 Set the option value as a string. More...
 
Bool TIDY_CALL tidyOptSnapshot (TidyDoc tdoc)
 Take a snapshot of current config settings. More...
 
Option Documentation
ctmbstr TIDY_CALL tidyOptGetDoc (TidyDoc tdoc, TidyOption opt)
 Get the description of the specified option. More...
 
TidyIterator TIDY_CALL tidyOptGetDocLinksList (TidyDoc tdoc, TidyOption opt)
 Initiates an iterator for a list of options related to a given option. More...
 
TidyOption TIDY_CALL tidyOptGetNextDocLinks (TidyDoc tdoc, TidyIterator *pos)
 Given a valid TidyIterator initiated with tidyOptGetDocLinksList(), returns a TidyOption instance. More...
 
Emacs-compatible reporting support.

If you work with Emacs and prefer Tidy's report output to be in a form that is easy for Emacs to parse, then these functions may be valuable.

ctmbstr TIDY_CALL tidyGetEmacsFile (TidyDoc tdoc)
 Get the file path to use for reports when TidyEmacs is being used. More...
 
void TIDY_CALL tidySetEmacsFile (TidyDoc tdoc, ctmbstr filePath)
 Set the file path to use for reports when TidyEmacs is being used. More...
 
Error Sink

Send Tidy's output to any of several destinations with these functions.

int TIDY_CALL tidySetErrorBuffer (TidyDoc tdoc, TidyBuffer *errbuf)
 Set error sink to given buffer. More...
 
FILE *TIDY_CALL tidySetErrorFile (TidyDoc tdoc, ctmbstr errfilnam)
 Set error sink to named file. More...
 
int TIDY_CALL tidySetErrorSink (TidyDoc tdoc, TidyOutputSink *sink)
 Set error sink to given generic sink. More...
 
TidyMessageCallback API

When using TidyMessageCallback you will be supplied with a TidyMessage object, which is used as a token to be interrogated with the following API before the callback returns.

Remarks
Upon returning from the callback, this object is destroyed so do not attempt to copy it, or keep it around, or use it in any way.
ctmbstr TIDY_CALL tidyGetMessage (TidyMessage tmessage)
 Get the message with the format string already completed, in Tidy's current localization. More...
 
uint TIDY_CALL tidyGetMessageCode (TidyMessage tmessage)
 Get the message code. More...
 
int TIDY_CALL tidyGetMessageColumn (TidyMessage tmessage)
 Get the column the message applies to. More...
 
ctmbstr TIDY_CALL tidyGetMessageDefault (TidyMessage tmessage)
 Get the message with the format string already completed, in Tidy's default localization. More...
 
TidyDoc TIDY_CALL tidyGetMessageDoc (TidyMessage tmessage)
 Get the tidy document this message comes from. More...
 
ctmbstr TIDY_CALL tidyGetMessageFormat (TidyMessage tmessage)
 Get the localized format string. More...
 
ctmbstr TIDY_CALL tidyGetMessageFormatDefault (TidyMessage tmessage)
 Get the default format string, which is the format string for the message in Tidy's default localization (en_us). More...
 
Bool TIDY_CALL tidyGetMessageIsMuted (TidyMessage tmessage)
 Get the muted status of the message, that is, whether or not the current configuration indicated that this message should be muted. More...
 
ctmbstr TIDY_CALL tidyGetMessageKey (TidyMessage tmessage)
 Get the message key string. More...
 
TidyReportLevel TIDY_CALL tidyGetMessageLevel (TidyMessage tmessage)
 Get the TidyReportLevel of the message. More...
 
int TIDY_CALL tidyGetMessageLine (TidyMessage tmessage)
 Get the line number the message applies to. More...
 
ctmbstr TIDY_CALL tidyGetMessageOutput (TidyMessage tmessage)
 Get the complete message as Tidy would emit it in the current localization. More...
 
ctmbstr TIDY_CALL tidyGetMessageOutputDefault (TidyMessage tmessage)
 Get the complete message as Tidy would emit it in the default localization. More...
 
ctmbstr TIDY_CALL tidyGetMessagePos (TidyMessage tmessage)
 Get the position part part of the message in the current language. More...
 
ctmbstr TIDY_CALL tidyGetMessagePosDefault (TidyMessage tmessage)
 Get the position part part of the message in the default language. More...
 
ctmbstr TIDY_CALL tidyGetMessagePrefix (TidyMessage tmessage)
 Get the prefix part of a message in the current language. More...
 
ctmbstr TIDY_CALL tidyGetMessagePrefixDefault (TidyMessage tmessage)
 Get the prefix part of a message in the default language. More...
 
TidyMessageCallback Arguments API

When using TidyMessageCallback you will be supplied with a TidyMessage object which can be used as a token against which to query using this API.

This API deals strictly with arguments that a message may or may not have; these are the same arguments that Tidy would apply to a format string in order to fill in the placeholder fields and deliver a complete report or dialogue string to you.

ctmbstr TIDY_CALL tidyGetArgFormat (TidyMessage tmessage, TidyMessageArgument *arg)
 Returns the format specifier of the given message argument. More...
 
TidyFormatParameterType TIDY_CALL tidyGetArgType (TidyMessage tmessage, TidyMessageArgument *arg)
 Returns the TidyFormatParameterType of the given message argument. More...
 
double TIDY_CALL tidyGetArgValueDouble (TidyMessage tmessage, TidyMessageArgument *arg)
 Returns the double value of the given message argument. More...
 
int TIDY_CALL tidyGetArgValueInt (TidyMessage tmessage, TidyMessageArgument *arg)
 Returns the integer value of the given message argument. More...
 
ctmbstr TIDY_CALL tidyGetArgValueString (TidyMessage tmessage, TidyMessageArgument *arg)
 Returns the string value of the given message argument. More...
 
uint TIDY_CALL tidyGetArgValueUInt (TidyMessage tmessage, TidyMessageArgument *arg)
 Returns the unsigned integer value of the given message argument. More...
 
TidyIterator TIDY_CALL tidyGetMessageArguments (TidyMessage tmessage)
 Initiates an iterator for a list of arguments related to a given message. More...
 
TidyMessageArgument TIDY_CALL tidyGetNextMessageArgument (TidyMessage tmessage, TidyIterator *iter)
 Given a valid TidyIterator initiated with tidyGetMessageArguments(), returns an instance of the opaque type TidyMessageArgument, which serves as a token against which the remaining argument API functions may be used to query information. More...
 
Nodes for Document Sections
TidyNode TIDY_CALL tidyGetBody (TidyDoc tdoc)
 Get the BODY node. More...
 
TidyNode TIDY_CALL tidyGetHead (TidyDoc tdoc)
 Get the HEAD node. More...
 
TidyNode TIDY_CALL tidyGetHtml (TidyDoc tdoc)
 Get the HTML node. More...
 
TidyNode TIDY_CALL tidyGetRoot (TidyDoc tdoc)
 Get the root node. More...
 
Relative Nodes
TidyNode TIDY_CALL tidyGetChild (TidyNode tnod)
 Get the child of the indicated node. More...
 
TidyNode TIDY_CALL tidyGetNext (TidyNode tnod)
 Get the next sibling node. More...
 
TidyNode TIDY_CALL tidyGetParent (TidyNode tnod)
 Get the parent of the indicated node. More...
 
TidyNode TIDY_CALL tidyGetPrev (TidyNode tnod)
 Get the previous sibling node. More...
 
Miscellaneous Node Functions
TidyNode TIDY_CALL tidyDiscardElement (TidyDoc tdoc, TidyNode tnod)
 Remove the indicated node. More...
 
Node Attribute Functions
void TIDY_CALL tidyAttrDiscard (TidyDoc itdoc, TidyNode tnod, TidyAttr tattr)
 Discard an attribute. More...
 
TidyAttr TIDY_CALL tidyAttrFirst (TidyNode tnod)
 Get the first attribute. More...
 
TidyAttr TIDY_CALL tidyAttrGetById (TidyNode tnod, TidyAttrId attId)
 Get an instance of TidyAttr by specifying an attribute ID. More...
 
TidyAttrId TIDY_CALL tidyAttrGetId (TidyAttr tattr)
 Get the attribute ID given a tidy attribute. More...
 
Bool TIDY_CALL tidyAttrIsEvent (TidyAttr tattr)
 Indicates whether or not a given attribute is an event attribute. More...
 
ctmbstr TIDY_CALL tidyAttrName (TidyAttr tattr)
 Get the name of a TidyAttr instance. More...
 
TidyAttr TIDY_CALL tidyAttrNext (TidyAttr tattr)
 Get the next attribute. More...
 
ctmbstr TIDY_CALL tidyAttrValue (TidyAttr tattr)
 Get the value of a TidyAttr instance. More...
 
Additional Node Interrogation
uint TIDY_CALL tidyNodeColumn (TidyNode tnod)
 Get the column location of the node. More...
 
TidyTagId TIDY_CALL tidyNodeGetId (TidyNode tnod)
 Get the tag ID of the node. More...
 
ctmbstr TIDY_CALL tidyNodeGetName (TidyNode tnod)
 Get the name of the node. More...
 
Bool TIDY_CALL tidyNodeGetText (TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf)
 Gets the text of a node and places it into the given TidyBuffer. More...
 
TidyNodeType TIDY_CALL tidyNodeGetType (TidyNode tnod)
 Get the type of node. More...
 
Bool TIDY_CALL tidyNodeGetValue (TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf)
 Get the value of the node. More...
 
Bool TIDY_CALL tidyNodeHasText (TidyDoc tdoc, TidyNode tnod)
 Indicates whether or not the node has text. More...
 
Bool TIDY_CALL tidyNodeIsHeader (TidyNode tnod)
 Indicates whether or not a node represents and HTML header element, such as h1, h2, etc. More...
 
Bool TIDY_CALL tidyNodeIsProp (TidyDoc tdoc, TidyNode tnod)
 Indicates whether or not the node is a propriety type. More...
 
Bool TIDY_CALL tidyNodeIsText (TidyNode tnod)
 Indicates whether or not a node is a text node. More...
 
uint TIDY_CALL tidyNodeLine (TidyNode tnod)
 Get the line number where the node occurs. More...
 
Tidy's Locale
ctmbstr TIDY_CALL tidyGetLanguage (void)
 Gets the current language used by Tidy. More...
 
Bool TIDY_CALL tidySetLanguage (ctmbstr languageCode)
 Tells Tidy to use a different language for output. More...
 
Locale Mappings
const tidyLocaleMapItem *TIDY_CALL getNextWindowsLanguage (TidyIterator *iter)
 Given a valid TidyIterator initiated with getWindowsLanguageList(), returns a pointer to a tidyLocaleMapItem, which can be further interrogated with TidyLangWindowsName() or TidyLangPosixName(). More...
 
TidyIterator TIDY_CALL getWindowsLanguageList (void)
 Initiates an iterator for a list of Tidy's Windows<->POSIX locale mappings. More...
 
ctmbstr TIDY_CALL TidyLangPosixName (const tidyLocaleMapItem *item)
 Given a tidyLocaleMapItem, return the POSIX name. More...
 
ctmbstr TIDY_CALL TidyLangWindowsName (const tidyLocaleMapItem *item)
 Given a tidyLocaleMapItem, return the Windows name. More...
 
Getting Localized Strings
uint TIDY_CALL getNextStringKey (TidyIterator *iter)
 Given a valid TidyIterator initiated with getStringKeyList(), returns an unsigned integer representing the next key value. More...
 
TidyIterator TIDY_CALL getStringKeyList (void)
 Initiates an iterator for a list of string key codes available in Tidy. More...
 
ctmbstr TIDY_CALL tidyDefaultString (uint messageType)
 Provides a string given messageType in the default localization (which is en). More...
 
ctmbstr TIDY_CALL tidyDefaultStringN (uint messageType, uint quantity)
 Provides a string given messageType in the default localization for quantity. More...
 
ctmbstr TIDY_CALL tidyLocalizedString (uint messageType)
 Provides a string given messageType in the current localization for the single case. More...
 
ctmbstr TIDY_CALL tidyLocalizedStringN (uint messageType, uint quantity)
 Provides a string given messageType in the current localization for quantity. More...
 
Available Languages
TidyIterator TIDY_CALL getInstalledLanguageList (void)
 Initiates an iterator for a list of Tidy's installed languages. More...
 
ctmbstr TIDY_CALL getNextInstalledLanguage (TidyIterator *iter)
 Given a valid TidyIterator initiated with getInstalledLanguageList(), returns a string representing a language name that is installed in Tidy. More...
 

Input Source

If you wish to write to your own input sources, then these types, structs, and functions will allow them to work seamlessly with Tidy.

#define EndOfStream   (~0u)
 End of input "character". More...
 
typedef Bool(TIDY_CALLTidyEOFFunc) (void *sourceData)
 Input Callback: is end of input? More...
 
uint TIDY_CALL tidyGetByte (TidyInputSource *source)
 Helper: get next byte from input source. More...
 
typedef int(TIDY_CALLTidyGetByteFunc) (void *sourceData)
 Input Callback: get next byte of input. More...
 
Bool TIDY_CALL tidyInitSource (TidyInputSource *source, void *srcData, TidyGetByteFunc gbFunc, TidyUngetByteFunc ugbFunc, TidyEOFFunc endFunc)
 Facilitates user defined source by providing an entry point to marshal pointers-to-functions. More...
 
Bool TIDY_CALL tidyIsEOF (TidyInputSource *source)
 Helper: check if input source at end. More...
 
void TIDY_CALL tidyUngetByte (TidyInputSource *source, uint byteValue)
 Helper: unget byte back to input source. More...
 
typedef void(TIDY_CALLTidyUngetByteFunc) (void *sourceData, byte bt)
 Input Callback: unget a byte of input. More...
 

Option Callback Functions

typedef Bool(TIDY_CALLTidyConfigCallback) (TidyDoc tdoc, ctmbstr option, ctmbstr value)
 This typedef represents the required signature for your provided callback function should you wish to register one with tidySetConfigCallback(). More...
 
typedef void(TIDY_CALLTidyConfigChangeCallback) (TidyDoc tdoc, TidyOption option)
 This typedef represents the required signature for your provided callback function should you wish to register one with tidySetConfigChangeCallback(). More...
 
typedef Bool(TIDY_CALLTidyOptCallback) (ctmbstr option, ctmbstr value)
 This typedef represents the required signature for your provided callback function should you wish to register one with tidySetOptionCallback(). More...
 
Bool TIDY_CALL tidySetConfigCallback (TidyDoc tdoc, TidyConfigCallback pConfigCallback)
 Applications using TidyLib may want to augment command-line and configuration file options. More...
 
Bool TIDY_CALL tidySetConfigChangeCallback (TidyDoc tdoc, TidyConfigChangeCallback pCallback)
 Applications using TidyLib may want to be informed when changes to options are made. More...
 
Bool TIDY_CALL tidySetOptionCallback (TidyDoc tdoc, TidyOptCallback pOptCallback)
 Applications using TidyLib may want to augment command-line and configuration file options. More...
 

Output Sink

Bool TIDY_CALL tidyInitSink (TidyOutputSink *sink, void *snkData, TidyPutByteFunc pbFunc)
 Facilitates user defined sinks by providing an entry point to marshal pointers-to-functions. More...
 
void TIDY_CALL tidyPutByte (TidyOutputSink *sink, uint byteValue)
 Helper: send a byte to output. More...
 
typedef void(TIDY_CALLTidyPutByteFunc) (void *sinkData, byte bt)
 Output callback: send a byte to output. More...
 

Error and Message Callbacks - TidyReportFilter

A simple callback to filter or collect messages by diagnostic level, for example, TidyInfo, TidyWarning, etc.

Its name reflects its original purpose as a filter, by which your application can inform LibTidy whether or not to output a particular report.

typedef Bool(TIDY_CALLTidyReportFilter) (TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg)
 This typedef represents the required signature for your provided callback function should you wish to register one with tidySetReportFilter(). More...
 
Bool TIDY_CALL tidySetReportFilter (TidyDoc tdoc, TidyReportFilter filtCallback)
 This function informs Tidy to use the specified callback to send reports. More...
 

Error and Message Callbacks - TidyReportCallback

A simple callback to filter or collect messages reported by Tidy.

Unlike TidyReportFilter, more data are provided (including a va_list), making this callback suitable for applications that provide more sophisticated handling of reports.

Remarks
The use of a va_list may preclude using this callback from non-C-like languages, which is uncharacteristic of Tidy. For more flexibility, consider using TidyMessageCallback instead.
Note
This callback was previously TidyMessageFilter3 in older versions of LibTidy.
typedef Bool(TIDY_CALLTidyReportCallback) (TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr code, va_list args)
 This typedef represents the required signature for your provided callback function should you wish to register one with tidySetReportCallback(). More...
 
Bool TIDY_CALL tidySetReportCallback (TidyDoc tdoc, TidyReportCallback filtCallback)
 This function informs Tidy to use the specified callback to send reports. More...
 

Error and Message Callbacks - TidyMessageCallback

A sophisticated and extensible callback to filter or collect messages reported by Tidy.

It returns only an opaque type TidyMessage for every report and dialogue message, and this message can be queried with the TidyMessageCallback API, below. Note that unlike the older filters, this callback exposes all output that LibTidy emits (excluding the console application, which is a client of LibTidy).

typedef Bool(TIDY_CALLTidyMessageCallback) (TidyMessage tmessage)
 This typedef represents the required signature for your provided callback function should you wish to register one with tidySetMessageCallback(). More...
 
Bool TIDY_CALL tidySetMessageCallback (TidyDoc tdoc, TidyMessageCallback filtCallback)
 This function informs Tidy to use the specified callback to send reports. More...
 

Printing

LibTidy applications can somewhat track the progress of the tidying process by using this provided callback.

It relates where something in the source document ended up in the output.

typedef void(TIDY_CALLTidyPPProgress) (TidyDoc tdoc, uint line, uint col, uint destLine)
 This typedef represents the required signature for your provided callback function should you wish to register one with tidySetMessageCallback(). More...
 
Bool TIDY_CALL tidySetPrettyPrinterCallback (TidyDoc tdoc, TidyPPProgress callback)
 This function informs Tidy to use the specified callback for tracking the pretty-printing process progress. More...