(zettel (meta (back "00001004051200 00001012920500") (backward "00001004051200 00001012920500") (box-number "1") (created "20230316181044") (forward "00001012920510 00001012920516 00001012930000") (modified "20230403150657") (published "20230403150657") (role "manual") (syntax "zmk") (tags "#api #manual #reference #zettelstore") (title "SHTML Encoding")) (rights 4) (encoding "") (content "A zettel representation that is a [[s-expression|00001012930000]], syntactically similar to the [[Sz encoding|00001012920516]], but denotes [[HTML|00001012920510]] semantics.\nIt is derived from a XML encoding in s-expressions, called [[SXML|https://en.wikipedia.org/wiki/SXML]].\n\nIt is (relatively) easy to parse and contains everything to transform it into real HTML.\nIn contrast to HTML, SHTML is easier to parse and to manipulate.\nFor example, take a look at the SHTML encoding of this page, which is available via the \"\"Info\"\" sub-page of this zettel: \n\n* [[//z/00001012920525?enc=shtml&part=zettel]],\n* [[//z/00001012920525?enc=shtml&part=meta]],\n* [[//z/00001012920525?enc=shtml&part=content]].\n\nIf transferred via HTTP, the content type will be ''text/plain''.\n\nInternally, if a zettel should be transformed into HTML, the zettel is translated into the [[Sz encoding|00001012920516]], which is transformed into this SHTML encoding to produce the [[HTML encoding|00001012920510]].\n\n=== Syntax of SHTML\nThere are only two types of elements: atoms and lists, similar to the Sz encoding.\n\nA list always starts with the left parenthesis (\"\"''(''\"\", U+0028) and ends with a right parenthesis (\"\"'')''\"\", U+0029).\nA list may contain a possibly empty sequence of elements, i.e. lists and / or atoms.\nBefore the last element of a list of at least to elements, a full stop character (\"\"''.''\"\", U+002E) signal a pair as the last two elements.\nThis allows a more space economic storage of data.\n\nAn HTML tag like ``< a href=\"link\">Text`` is encoded in SHTML with a list, where the first element is a symbol named a the tag.\nThe second element is an optional encoding of the tag's attributes.\nFurther elements are either other tag encodings or a string.\nThe above tag is encoded as ``(a (@ (href . \"link\")) \"Text\")``.\nAlso possible is to encode the attribute without pairs: ``(a (@ (href \"link\")) \"Text\")`` (note the missing full stop character)."))