(zettel (meta (back "00001007000000 00001007010000 00001007030400 00001007030500 00001007030600 00001007030700 00001007030800 00001007030900 00001007031100 00001007031110 00001007031200 00001007031300 00001007031400 00001007040100 00001007040200 00001007040322 00001007800000 00001012931000") (backward "00001007000000 00001007010000 00001007030400 00001007030500 00001007030600 00001007030700 00001007030800 00001007030900 00001007031100 00001007031110 00001007031200 00001007031300 00001007031400 00001007040000 00001007040100 00001007040200 00001007040322 00001007050100 00001007800000 00001012931000") (box-number "1") (created "20210126175322") (forward "00001007030000 00001007040000 00001007050100 00001007050200") (modified "20220630194106") (published "20220630194106") (role "manual") (syntax "zmk") (tags "#manual #zettelmarkup #zettelstore") (title "Zettelmarkup: Attributes")) (rights 4) (encoding "") (content "Attributes allows to modify the way how material is presented.\nAlternatively, they provide additional information to markup elements.\nTo some degree, attributes are similar to [[HTML attributes|https://html.spec.whatwg.org/multipage/dom.html#global-attributes]].\n\nTypical use cases for attributes are to specify the (natural) [[language|00001007050100]] for a text region, to specify the [[programming language|00001007050200]] for highlighting program code, or to make white space visible in plain text.\n\nAttributes are specified within curly brackets ``{...}``.\nOf course, more than one attribute can be specified.\nAttributes are separated by a sequence of space characters or by a comma character.\n\nAn attribute normally consists of an optional key and an optional value.\nThe key is a sequence of letters, digits, a hyphen-minus (\"\"''-''\"\", U+002D, and a low line / underscore (\"\"''_''\"\", U+005D).\nIt can be empty.\nThe value is a sequence of any character, except space and the right curly bracket (\"\"''}''\"\", U+007D).\nIf the value must contain a space or the right curly bracket, the value can be specified within two quotation marks (\"\"''\"''\"\", U+0022).\nWithin the quotation marks, the backslash character functions as an escape character to specify the quotation mark (and the backslash character too).\n\nSome examples:\n\n* ``{key=value}`` sets the attribute __key__ to value __value__.\n* ``{key=\"value with space\"}`` sets the attribute to the given value.\n* ``{key=\"value with quote \\\\\" (and backslash \\\\\\\\)\"}``\n* ``{name}`` sets the attribute __name__.\n It has no corresponding value.\n It is equivalent to ``{name=}``.\n* ``{=key}`` sets the __generic attribute__ to the given value.\n It is mostly used for modifying behavior according to a programming language.\n* ``{.key}`` sets the __class attribute__ to the given value.\n It is equivalent to ``{class=key}``. \n\nIn these examples, ``key`` must conform the the syntax of attribute keys, even if it is used as a value.\n\nIf a key is given more than once in an attribute, the values are concatenated (and separated by a space).\n\n* ``{key=value1 key=value2}`` is the same as ``{key\"value1 value2\"}``.\n* ``{key key}`` is the same as ``{key}``.\n* ``{.class1 .class2}`` is equivalent to ``{class=\"class1 class2\"}``.\n\nThis is not true for the generic attribute.\nIn ``{=key1 =key2}``, the first key is ignored.\nTherefore it is equivalent to ``{=key2}``.\n\nThe key \"\"''-''\"\" (just hyphen-minus) is special.\nIt is called __default attribute__ and has a markup specific meaning.\nFor example, when used for plain text, it replaces the non-visible space with a visible representation:\n\n* ''``Hello, world``{-}'' produces ==Hello, world=={-}.\n* ''``Hello, world``'' produces ==Hello, world==.\n\nAttributes may be continued on the next line when a space or line ending character is possible.\nIn case of a quoted attribute value, the line ending character will be part of the attribute value.\nFor example:\n```\n{key=\"quoted\nvalue\"}\n```\nwill produce a value ''quoted\\\\nvalue'' (where \\\\n denotes a line ending character).\n\n\n```\n::GREEN::{class=example\nbackground=grey}\n```\nis allowed, but not\n```\n::GREEN::{background=color:\ngreen}\n```.\n\nHowever,\n```\n::GREEN::{background=color:\"\ngreen\"}\n```\nis allowed, because line endings are allowed within quotes.\n\nFor [[block-structured elements|00001007030000]], there is a syntax variant if you only want to specify a generic attribute.\nFor all line-range blocks you can specify the generic attributes directly in the first line, after the three (or more) characters starting the block.\n\n```\n:::attr\n...\n:::\n```\nis equivalent to\n```\n:::{=attr}\n...\n:::\n```.\n\nFor block-structured elements, spaces are allowed between the blocks characters and the attributes.\n```\n=== Heading {example}\n```\nis allowed and equivalent to\n```\n=== Heading{example}\n```.\n\nFor [[inline-structured elements|00001007040000]], the attributes must immediately follow the inline markup.\n\n``::GREEN::{example}`` is allowed, but not ``::GREEN:: {example}``.\n\n\n=== Reference material\n* [[Supported attribute values for natural languages|00001007050100]]\n* [[Supported attribute values for programming languages|00001007050200]]"))