tidy-html5/README/TAGS.md
Jim Derry 5f05add439 Continue the documentation effort!
- Many, many updates to the public header files.
- tidyenum.h was reorganized substantially in order to better generate
  documentation with Doxygen.
- This was also a good time to clean up all of the various enums for languages
  and strings. Everything is simple and in a single enum now, other than a
  couple of cases (TidyOptionId, for example, doesn't need to be redefined).
- A full and complete audit of the strings meant some opportunities to delete
  useless strings.
- Reorganized the order of the strings in language_en.h in order to better
  find things when programmers want to make changes. There are a lot fewer
  internal "sections" now, and everything has been painstakingly sorted within
  the remaining sections.
- Consequently rebased all of the PO's, POT, and other language files.
- Updated several of the READMEs with the newest information.
- Made the READMEs easier to copy into the Doxygen project by changing some of
  the code format for compatibility, mainly the use of tildes instead of
  backslashes for code blocks.
- Added tidyGetMessageCode() to message API. Despite the huge diff, this is the
  only externally-visible change, other than removing some enums (but not their
  values!).
- Passing `next` tests on Mac, Linux, Win10.
2017-03-22 16:05:13 -04:00

1.9 KiB

Tidy HTML Elements

This is about adding a new HTML tag.

Tidy tries to support all tags supported by the W3C. To add a new supported tag, the defintion begins in tidyenum.h, to give it a value. Then it is added to the tag_defs[] table in tags.c, where it is given a unique string, supported html versions, attributes support, and a bit type.

Note, there are a group of configuration options to add tags not yet approved by the W3C. These are new-blocklevel-tags, new-empty-tags, new-inline-tags. and new-pre-tags. This provides a way to extend the tag_defs[] table just for that tidy session.

So, adding a new HTML tag consists of the following simple steps:

  1. tidyenum.h - Give the element an internal name, like TidyTag_XXXX, and thus a value. Please keep this list in alphabetical order.

  2. tags.c - Add a line to the tag_defs[] table. This assigns the unique string value of the element. Then the html versions that support the element, a pointer to the attributes supported by that elelment, and a bit field of the elements characteristics, inline, block, etc.

So, just changing 2 files, tidyenum.h and tags.c, and libTidy will now support that element, tag, as W3C approved. Simple... And at times, there is some case for adding tags that are still in the Working Draft stage, especially when there has been wide spread support in the community, even before it reaches REC stage.

Now, one could argue that this is not the best way to verify every attribute and value, for every tag, but that is a moot point - that is how tidy does it!

; eof 20170205