1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
/*
* Copyright (c) Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file is for direct inclusion into term.c. It allows an easy
* place to make compile-term overrides of default styles.
*/
/*
* Styles
* ======
*
* Begin with text styles. Each style should be formatted as follows:
*
* static const struct sty sty_STYLE = {
* italic?, strike?, bold?, under?, bgcolour, colour, override?
* };
*
* Italic, strike, bold, and under may be zero or non-zero numbers. If
* non-zero, the given style is applied and is inherited by all child
* styles.
*
* Override is a bit-mask of styles that are overridden. If 1 is set,
* the underline is overridden; if 2, the bold.
*
* Bgcolour and colour may be zero or an 8-bit ANSI colour escape code
* for standard or high-intensity colours, e.g., 30 = black, 36 = cyan,
* 91 = bright red. Non-conforming values are ignored. See
* <https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit>. These
* are not inherited by child styles.
*
* Please note that if NO_COLOR is specified during run-time, all of the
* colour codes will be stripped. When customising this, please make
* sure that your style will work both with colours and without.
*/
/* For inserted content. Common parent style. */
static const struct sty sty_chng_ins = { 0, 0, 0, 0, 44, 0, 0 };
/* For deleted content. Common parent style. */
static const struct sty sty_chng_del = { 0, 0, 0, 0, 41, 0, 0 };
/* Image: >< */
static const struct sty sty_img = { 0, 0, 1, 0, 0, 93, 1 };
/* Box around image link (in sty_img):  */
static const struct sty sty_imgbox = { 0, 0, 0, 0, 0, 37, 2 };
/* Image link text (in sty_img):  */
static const struct sty sty_imgurl = { 0, 0, 0, 1, 0, 32, 2 };
/* Footnote reference (as a number): >[^ref]< */
static const struct sty sty_fref = { 0, 0, 1, 0, 0, 93, 1 };
/* In-line code: >`foo(void)`< */
static const struct sty sty_codespan = { 0, 0, 1, 0, 0, 94, 0 };
/* Block code: ```foo(void)```< */
static const struct sty sty_blockcode = { 0, 0, 1, 0, 0, 0, 0 };
/* Horizontal line: >***< */
static const struct sty sty_hrule = { 0, 0, 0, 0, 0, 37, 0 };
/* Block HTML: ><html></html>< */
static const struct sty sty_blockhtml = { 0, 0, 0, 0, 0, 37, 0 };
/* In-line HTML: ><span>< */
static const struct sty sty_rawhtml = { 0, 0, 0, 0, 0, 37, 0 };
/* Strike-through: >~~foo~~< */
static const struct sty sty_strike = { 0, 1, 0, 0, 0, 0, 0 };
/* Emphasis: >*foo*< */
static const struct sty sty_emph = { 1, 0, 0, 0, 0, 0, 0 };
/* Highlight: >==foo==< */
static const struct sty sty_highlight = { 0, 0, 1, 0, 0, 0, 0 };
/* Double-emphasis: >**foo**< */
static const struct sty sty_d_emph = { 0, 0, 1, 0, 0, 0, 0 };
/* Triple emphasis: >***foo***< */
static const struct sty sty_t_emph = { 1, 0, 1, 0, 0, 0, 0 };
/* Link: >[text](link)< */
static const struct sty sty_link = { 0, 0, 0, 1, 0, 32, 0 };
/* Link text (in sty_link): [>text<](link) */
static const struct sty sty_linkalt = { 0, 0, 1, 0, 0, 93, 1|2 };
/* Standalone link: >https://link< */
static const struct sty sty_autolink = { 0, 0, 0, 1, 0, 32, 0 };
/* Header: >## Header< */
static const struct sty sty_header = { 0, 0, 1, 0, 0, 0, 0 };
/* First header (in sty_header): ># Header< */
static const struct sty sty_header_1 = { 0, 0, 0, 0, 0, 91, 0 };
/* Non-first header (in sty_header): >### Header< */
static const struct sty sty_header_n = { 0, 0, 0, 0, 0, 36, 0 };
/* Footnote block: >[^ref]: foo bar< */
static const struct sty sty_foot = { 0, 0, 0, 0, 0, 37, 0 };
/* Footnote prefix (in sty_foot, as a number): >[^ref]<: foo bar */
static const struct sty sty_fdef_pfx = { 0, 0, 0, 0, 0, 92, 1 };
/* Metadata key: >key:< val */
static const struct sty sty_meta_key = { 0, 0, 0, 0, 0, 37, 0 };
/* Entity (if not valid): >&#badent;< */
static const struct sty sty_bad_ent = { 0, 0, 0, 0, 0, 37, 0 };
/* Definition list data prefix (see pfx_dli_1): foo \n >:< bar */
static const struct sty sty_dli_pfx = { 0, 0, 0, 0, 0, 93, 0 };
/* List prefix (see pfx_li_1): >1.< foo */
static const struct sty sty_li_pfx = { 0, 0, 0, 0, 0, 93, 0 };
/* Block quote prefix (see pfx_bkqt): >|< foo */
static const struct sty sty_bkqt_pfx = { 0, 0, 0, 0, 0, 93, 0 };
/* Block code prefix (see pfx_bkcd): ``` >|< void \n >|< main``` */
static const struct sty sty_bkcd_pfx = { 0, 0, 0, 0, 0, 94, 0 };
/* Table separator (see ifx_tbl_col, ifx_tbl_mcol, ifx_tbl_row). */
static const struct sty sty_tbl = { 0, 0, 0, 0, 0, 93, 0 };
/*
* Prefixes
* ========
*
* What follows are hard-coded prefixes. These appear on the left of
* the output. Each prefix is arranged as:
*
* static const struct pfx pfx_STYLE = { text, columns };
*
* The text is a quoted string that will be inserted as-is. It may
* contain UTF-8 values. It may be NULL *only* if the documentation
* specifically says that the value is ignored.
*
* Columns is the number of terminal columns that the prefix fills. If
* this is wrong, it will throw off line wrapping. XXX: this may be
* dynamically computed in later versions of lowodwn.
*
* If the prefix text is ignored, the columns are the minimum: for
* example, an ordered list may have numbers >100, which with the ". "
* would be greater than 4, if 4 is given as the columns. However, at
* least 4 spaces would be printed, even if it were "1. " -> " 1. ".
*/
/* Block code (see sty_bkcd_pfx). */
static const struct pfx pfx_bkcd = { " │ ", 4 };
/* Block quote (see sty_bkqt_pfx). */
static const struct pfx pfx_bkqt = { " │ ", 4 };
/* Definition list data, first line (see sty_dli_pfx). */
static const struct pfx pfx_dli_1 = { " : ", 4 };
/* Definition list data, subsequent line (see sty_dli_pfx). */
static const struct pfx pfx_dli_n = { " ", 4 };
/* Minimum ordered list item, first line (see sty_li_pfx). Text ignored. */
static const struct pfx pfx_oli_1 = { NULL, 4 };
/* Unordered list item, first line (see sty_li_pfx). */
static const struct pfx pfx_uli_1 = { " · ", 4 };
/* Unordered, checked list data, first line (see sty_li_pfx). */
static const struct pfx pfx_uli_c1 = { " ☑ ", 4 };
/* Unordered, unchecked list data, first line (see sty_li_pfx). */
static const struct pfx pfx_uli_nc1 = { " ☐ ", 4 };
/* List items, subsequent lines (see sty_li_pfx). */
static const struct pfx pfx_li_n = { " ", 4 };
/* Minimum footnote prefix, first line (see sty_fdef_pfx). Text ignored. */
static const struct pfx pfx_fdef_1 = { NULL, 4 };
/* Footnote prefix, subsequent lines (see sty_fdef_pfx). */
static const struct pfx pfx_fdef_n = { " ", 4 };
/* Header first prefix (see sty_header_1). */
static const struct pfx pfx_header_1 = { "", 0 };
/* Header non-first prefix, one per head level (see sty_header_n). */
static const struct pfx pfx_header_n = { "#", 1 };
/*
* Infixes
* =======
*
* These are character strings that appear throughout text. They may
* consist of UTF-8 characters. NULL is not allowed.
*/
/* Footnote block header (see sty_foot). */
static const char *ifx_foot = "─";
/* Superscript. */
static const char *ifx_super = "^";
/* Metadata key (see sty_meta_key). */
static const char *ifx_meta_key = ": ";
/* Horizontal rule (repeats until covering full space). */
static const char *ifx_hrule = "─";
/* Image link box left-box (see sty_imgbox). */
static const char *ifx_imgbox_left = "[🖻 ";
/* Image link box right-box (see sty_imgbox). */
static const char *ifx_imgbox_right = "]";
/* Image link box separator (see sty_imgbox). */
static const char *ifx_imgbox_sep = " ";
/* Link separator. */
static const char *ifx_link_sep = " ";
/* Footnote reference left-box (see sty_fref). */
static const char *ifx_fref_left = "[";
/* Footnote reference right-box (see sty_fref). */
static const char *ifx_fref_right = "]";
/* Table column separator (see sty_tbl). */
static const char *ifx_tbl_col = "│";
/* Table header row separator (see sty_tbl). */
static const char *ifx_tbl_row = "─";
/* Table header row cross-separator (see sty_tbl). */
static const char *ifx_tbl_mcol = "┼";
|