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 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260
|
.. _build-config:
=============
Configuration
=============
.. module:: conf
:synopsis: Build configuration file.
.. role:: code-c(code)
:language: C
.. role:: code-cpp(code)
:language: C++
.. role:: code-js(code)
:language: JavaScript
.. role:: code-py(code)
:language: Python
.. role:: code-rst(code)
:language: reStructuredText
.. role:: code-tex(code)
:language: LaTeX
The :term:`configuration directory` must contain a file named :file:`conf.py`.
This file (containing Python code) is called the "build configuration file"
and contains (almost) all configuration needed to customise Sphinx input
and output behaviour.
An optional file `docutils.conf`_ can be added to the configuration
directory to adjust `Docutils`_ configuration if not otherwise overridden or
set by Sphinx.
.. _`docutils`: https://docutils.sourceforge.io/
.. _`docutils.conf`: https://docutils.sourceforge.io/docs/user/config.html
Important points to note:
* If not otherwise documented, values must be strings,
and their default is the empty string.
* The term "fully-qualified name" (FQN) refers to a string that names an importable
Python object inside a module; for example, the fully-qualified name
:code-py:`"sphinx.builders.Builder"` means the :code-py:`Builder` class in the
:code-py:`sphinx.builders` module.
* Document names use ``/`` as the path separator
and do not contain the file name extension.
.. _glob-style patterns:
* Where glob-style patterns are permitted,
you can use the standard shell constructs
(``*``, ``?``, ``[...]``, and ``[!...]``)
with the feature that none of these will match slashes (``/``).
A double star ``**`` can be used to match any sequence of characters
*including* slashes.
.. tip::
The configuration file is executed as Python code at build time
(using :func:`importlib.import_module`, with the current directory set
to the :term:`configuration directory`),
and therefore can execute arbitrarily complex code.
Sphinx then reads simple names from the file's namespace as its configuration.
In general, configuration values should be simple strings, numbers, or
lists or dictionaries of simple values.
The contents of the config namespace are pickled (so that Sphinx can find out
when configuration changes), so it may not contain unpickleable values --
delete them from the namespace with ``del`` if appropriate.
Modules are removed automatically, so deleting imported modules is not needed.
.. _conf-tags:
Project tags
============
There is a special object named ``tags`` available in the config file,
which exposes the :ref:`project tags <tags>`.
Tags are defined either via the
:option:`--tag <sphinx-build --tag>` command-line option
or :code-py:`tags.add('tag')`.
Note that the builder's name and format tags are not available in :file:`conf.py`.
It can be used to query and change the defined tags as follows:
* To query whether a tag is set, use :code-py:`'tag' in tags`.
* To add a tag, use :code-py:`tags.add('tag')`.
* To remove a tag, use :code-py:`tags.remove('tag')`.
Project information
===================
.. confval:: project
:type: :code-py:`str`
:default: :code-py:`'Project name not set'`
The documented project's name.
Example:
.. code-block:: python
project = 'Thermidor'
.. confval:: author
:type: :code-py:`str`
:default: :code-py:`'Author name not set'`
The project's author(s).
Example:
.. code-block:: python
author = 'Joe Bloggs'
.. _config-copyright:
.. confval:: copyright
project_copyright
:type: :code-py:`str | Sequence[str]`
:default: :code-py:`''`
A copyright statement.
Permitted styles are as follows, where 'YYYY' represents a four-digit year.
* :code-py:`copyright = 'YYYY'`
* :code-py:`copyright = 'YYYY, Author Name'`
* :code-py:`copyright = 'YYYY Author Name'`
* :code-py:`copyright = 'YYYY-YYYY, Author Name'`
* :code-py:`copyright = 'YYYY-YYYY Author Name'`
If the string :code-py:`'%Y'` appears in a copyright line,
it will be replaced with the current four-digit year.
For example:
* :code-py:`copyright = '%Y'`
* :code-py:`copyright = '%Y, Author Name'`
* :code-py:`copyright = 'YYYY-%Y, Author Name'`
.. versionadded:: 3.5
The :code-py:`project_copyright` alias.
.. versionchanged:: 7.1
The value may now be a sequence of copyright statements in the above form,
which will be displayed each to their own line.
.. versionchanged:: 8.1
Copyright statements support the :code-py:`'%Y'` placeholder.
.. confval:: version
:type: :code-py:`str`
:default: :code-py:`''`
The major project version, used as the replacement for the :code-rst:`|version|`
:ref:`default substitution <default-substitutions>`.
This may be something like :code-py:`version = '4.2'`.
The full project version is defined in :confval:`release`.
If your project does not draw a meaningful distinction between
between a 'full' and 'major' version,
set both :code-py:`version` and :code-py:`release` to the same value.
.. confval:: release
:type: :code-py:`str`
:default: :code-py:`''`
The full project version, used as the replacement for the :code-rst:`|release|`
:ref:`default substitution <default-substitutions>`, and
e.g. in the HTML templates.
This may be something like :code-py:`release = '4.2.1b0'`.
The major (short) project version is defined in :confval:`version`.
If your project does not draw a meaningful distinction between
between a 'full' and 'major' version,
set both :code-py:`version` and :code-py:`release` to the same value.
General configuration
=====================
.. confval:: needs_sphinx
:type: :code-py:`str`
:default: :code-py:`''`
Set a minimum supported version of Sphinx required to build the project.
The format should be a ``'major.minor'`` version string like ``'1.1'``
Sphinx will compare it with its version and refuse to build the project
if the running version of Sphinx is too old.
By default, there is no minimum version.
.. versionadded:: 1.0
.. versionchanged:: 1.4
Allow a ``'major.minor.micro'`` version string.
.. confval:: extensions
:type: :code-py:`list[str]`
:default: :code-py:`[]`
A list of strings that are module names of
:doc:`Sphinx extensions <extensions/index>`.
These can be extensions bundled with Sphinx (named ``sphinx.ext.*``)
or custom first-party or third-party extensions.
To use a third-party extension, you must ensure that it is installed
and include it in the :code-py:`extensions` list, like so:
.. code-block:: python
extensions = [
...
'numpydoc',
]
There are two options for first-party extensions.
The configuration file itself can be an extension;
for that, you only need to provide a :func:`setup` function in it.
Otherwise, you must ensure that your custom extension is importable,
and located in a directory that is in the Python path.
Ensure that absolute paths are used when modifying :data:`sys.path`.
If your custom extensions live in a directory that is relative to the
:term:`configuration directory`, use :meth:`pathlib.Path.resolve` like so:
.. code-block:: python
import sys
from pathlib import Path
sys.path.append(str(Path('sphinxext').resolve()))
extensions = [
...
'extname',
]
The directory structure illustrated above would look like this:
.. code-block:: none
<project directory>/
├── conf.py
└── sphinxext/
  └── extname.py
.. confval:: needs_extensions
:type: :code-py:`dict[str, str]`
:default: :code-py:`{}`
If set, this value must be a dictionary specifying version requirements
for extensions in :confval:`extensions`.
The version strings should be in the ``'major.minor'`` form.
Requirements do not have to be specified for all extensions,
only for those you want to check.
Example:
.. code-block:: python
needs_extensions = {
'sphinxcontrib.something': '1.5',
}
This requires that the extension declares its version
in the :code-py:`setup()` function. See :ref:`dev-extensions` for further details.
.. versionadded:: 1.3
.. confval:: manpages_url
:type: :code-py:`str`
:default: :code-py:`''`
A URL to cross-reference :rst:role:`manpage` roles.
If this is defined to ``https://manpages.debian.org/{path}``,
the :literal:`:manpage:`man(1)`` role will link to
<https://manpages.debian.org/man(1)>.
The patterns available are:
``page``
The manual page (``man``)
``section``
The manual section (``1``)
``path``
The original manual page and section specified (``man(1)``)
This also supports manpages specified as ``man.1``.
.. code-block:: python
# To use manpages.debian.org:
manpages_url = 'https://manpages.debian.org/{path}'
# To use man7.org:
manpages_url = 'https://man7.org/linux/man-pages/man{section}/{page}.{section}.html'
# To use linux.die.net:
manpages_url = 'https://linux.die.net/man/{section}/{page}'
# To use helpmanual.io:
manpages_url = 'https://helpmanual.io/man{section}/{page}'
.. versionadded:: 1.7
.. confval:: today
today_fmt
These values determine how to format the current date,
used as the replacement for the :code-rst:`|today|`
:ref:`default substitution <default-substitutions>`.
* If you set :confval:`today` to a non-empty value, it is used.
* Otherwise, the current time is formatted using :func:`time.strftime` and
the format given in :confval:`today_fmt`.
The default for :confval:`today` is :code-py:`''`,
and the default for :confval:`today_fmt` is :code-py:`'%b %d, %Y'`
(or, if translation is enabled with :confval:`language`,
an equivalent format for the selected locale).
Options for figure numbering
----------------------------
.. confval:: numfig
:type: :code-py:`bool`
:default: :code-py:`False`
If :code-py:`True`, figures, tables and code-blocks are automatically numbered
if they have a caption.
The :rst:role:`numref` role is enabled.
Obeyed so far only by HTML and LaTeX builders.
.. note::
The LaTeX builder always assigns numbers whether this option is enabled
or not.
.. versionadded:: 1.3
.. confval:: numfig_format
:type: :code-py:`dict[str, str]`
:default: :code-py:`{}`
A dictionary mapping :code-py:`'figure'`, :code-py:`'table'`,
:code-py:`'code-block'` and :code-py:`'section'` to strings
that are used for format of figure numbers.
The marker ``%s`` will be replaced with the figure number.
The defaults are:
.. code-block:: python
numfig_format = {
'code-block': 'Listing %s',
'figure': 'Fig. %s',
'section': 'Section',
'table': 'Table %s',
}
.. versionadded:: 1.3
.. confval:: numfig_secnum_depth
:type: :code-py:`int`
:default: :code-py:`1`
* If set to :code-py:`0`, figures, tables, and code-blocks
are continuously numbered starting at ``1``.
* If :code-py:`1`, the numbering will be ``x.1``, ``x.2``, ...
with ``x`` representing the section number.
(If there is no top-level section, the prefix will not be added ).
This naturally applies only if section numbering has been activated via
the ``:numbered:`` option of the :rst:dir:`toctree` directive.
* If :code-py:`2`, the numbering will be ``x.y.1``, ``x.y.2``, ...
with ``x`` representing the section number and ``y`` the sub-section number.
If located directly under a section, there will be no ``y.`` prefix,
and if there is no top-level section, the prefix will not be added.
* Any other positive integer can be used, following the rules above.
.. versionadded:: 1.3
.. versionchanged:: 1.7
The LaTeX builder obeys this setting
if :confval:`numfig` is set to :code-py:`True`.
Options for highlighting
------------------------
.. confval:: highlight_language
:type: :code-py:`str`
:default: :code-py:`'default'`
The default language to highlight source code in.
The default is :code-py:`'default'`,
which suppresses warnings if highlighting as Python code fails.
The value should be a valid Pygments lexer name, see
:ref:`code-examples` for more details.
.. versionadded:: 0.5
.. versionchanged:: 1.4
The default is now :code-py:`'default'`.
.. confval:: highlight_options
:type: :code-py:`dict[str, dict[str, Any]]`
:default: :code-py:`{}`
A dictionary that maps Pygments lexer names to their options.
These are lexer-specific; for the options understood by each,
see the `Pygments documentation <https://pygments.org/docs/lexers>`_.
Example:
.. code-block:: python
highlight_options = {
'default': {'stripall': True},
'php': {'startinline': True},
}
.. versionadded:: 1.3
.. versionchanged:: 3.5
Allow configuring highlight options for multiple lexers.
.. confval:: pygments_style
:type: :code-py:`str`
:default: :code-py:`'sphinx'`
The style name to use for Pygments highlighting of source code.
If not set, either the theme's default style
or :code-py:`'sphinx'` is selected for HTML output.
.. versionchanged:: 0.3
If the value is a fully-qualified name of a custom Pygments style class,
this is then used as custom style.
Options for HTTP requests
-------------------------
.. confval:: tls_verify
:type: :code-py:`bool`
:default: :code-py:`True`
If True, Sphinx verifies server certificates.
.. versionadded:: 1.5
.. confval:: tls_cacerts
:type: :code-py:`str | dict[str, str]`
:default: :code-py:`''`
A path to a certification file of CA or
a path to directory which contains the certificates.
This also allows a dictionary mapping
hostnames to the certificate file path.
The certificates are used to verify server certifications.
.. versionadded:: 1.5
.. tip::
Sphinx uses requests_ as a HTTP library internally.
If :confval:`!tls_cacerts` is not set,
Sphinx falls back to requests' default behaviour.
See :ref:`requests:verification` for further details.
.. _requests: https://requests.readthedocs.io/
.. confval:: user_agent
:type: :code-py:`str`
:default: :code-py:`'Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 \
Firefox/100.0 Sphinx/X.Y.Z'`
Set the User-Agent used by Sphinx for HTTP requests.
.. versionadded:: 2.3
.. _intl-options:
Options for internationalisation
--------------------------------
These options influence Sphinx's *Native Language Support*.
See the documentation on :ref:`intl` for details.
.. confval:: language
:type: :code-py:`str`
:default: :code-py:`'en'`
The code for the language the documents are written in.
Any text automatically generated by Sphinx will be in that language.
Also, Sphinx will try to substitute individual paragraphs
from your documents with the translation sets obtained
from :confval:`locale_dirs`.
Sphinx will search language-specific figures named by
:confval:`figure_language_filename`
(e.g. the German version of ``myfigure.png`` will be ``myfigure.de.png``
by default setting)
and substitute them for original figures.
In the LaTeX builder, a suitable language will be selected
as an option for the *Babel* package.
.. versionadded:: 0.5
.. versionchanged:: 1.4
Support figure substitution
.. versionchanged:: 5.0
The default is now :code-py:`'en'` (previously :code-py:`None`).
Currently supported languages by Sphinx are:
* ``ar`` -- Arabic
* ``bg`` -- Bulgarian
* ``bn`` -- Bengali
* ``ca`` -- Catalan
* ``cak`` -- Kaqchikel
* ``cs`` -- Czech
* ``cy`` -- Welsh
* ``da`` -- Danish
* ``de`` -- German
* ``el`` -- Greek
* ``en`` -- English (default)
* ``eo`` -- Esperanto
* ``es`` -- Spanish
* ``et`` -- Estonian
* ``eu`` -- Basque
* ``fa`` -- Iranian
* ``fi`` -- Finnish
* ``fr`` -- French
* ``he`` -- Hebrew
* ``hi`` -- Hindi
* ``hi_IN`` -- Hindi (India)
* ``hr`` -- Croatian
* ``hu`` -- Hungarian
* ``id`` -- Indonesian
* ``it`` -- Italian
* ``ja`` -- Japanese
* ``ko`` -- Korean
* ``lt`` -- Lithuanian
* ``lv`` -- Latvian
* ``mk`` -- Macedonian
* ``nb_NO`` -- Norwegian Bokmal
* ``ne`` -- Nepali
* ``nl`` -- Dutch
* ``pl`` -- Polish
* ``pt`` -- Portuguese
* ``pt_BR`` -- Brazilian Portuguese
* ``pt_PT`` -- European Portuguese
* ``ro`` -- Romanian
* ``ru`` -- Russian
* ``si`` -- Sinhala
* ``sk`` -- Slovak
* ``sl`` -- Slovenian
* ``sq`` -- Albanian
* ``sr`` -- Serbian
* ``sr@latin`` -- Serbian (Latin)
* ``sr_RS`` -- Serbian (Cyrillic)
* ``sv`` -- Swedish
* ``ta`` -- Tamil
* ``te`` -- Telugu
* ``tr`` -- Turkish
* ``uk_UA`` -- Ukrainian
* ``ur`` -- Urdu
* ``vi`` -- Vietnamese
* ``zh_CN`` -- Simplified Chinese
* ``zh_TW`` -- Traditional Chinese
.. confval:: locale_dirs
:type: :code-py:`list[str]`
:default: :code-py:`['locales']`
Directories in which to search for additional message catalogs
(see :confval:`language`), relative to the source directory.
The directories on this path are searched by the :mod:`gettext` module.
Internal messages are fetched from a text domain of ``sphinx``;
so if you add the directory :file:`./locales` to this setting,
the message catalogs
(compiled from ``.po`` format using :program:`msgfmt`)
must be in :file:`./locales/{language}/LC_MESSAGES/sphinx.mo`.
The text domain of individual documents
depends on :confval:`gettext_compact`.
.. note::
The :option:`-v option to sphinx-build <sphinx-build -v>`
is useful to check the :confval:`!locale_dirs` setting is working as expected.
If the message catalog directory not found, debug messages are emitted.
.. versionadded:: 0.5
.. versionchanged:: 1.5
Use ``locales`` directory as a default value
.. confval:: gettext_allow_fuzzy_translations
:type: :code-py:`bool`
:default: :code-py:`False`
If True, "fuzzy" messages in the message catalogs are used for translation.
.. versionadded:: 4.3
.. confval:: gettext_compact
:type: :code-py:`bool | str`
:default: :code-py:`True`
* If :code-py:`True`, a document's text domain is
its docname if it is a top-level project file
and its very base directory otherwise.
* If :code-py:`False`, a document's text domain is
the docname, in full.
* If set to a string, every document's text domain is
set to this string, making all documents use single text domain.
With :code-py:`gettext_compact = True`, the document
:file:`markup/code.rst` ends up in the ``markup`` text domain.
With this option set to :code-py:`False`, it is ``markup/code``.
With this option set to :code-py:`'sample'`, it is ``sample``.
.. versionadded:: 1.1
.. versionchanged:: 3.3
Allow string values.
.. confval:: gettext_uuid
:type: :code-py:`bool`
:default: :code-py:`False`
If :code-py:`True`, Sphinx generates UUID information
for version tracking in message catalogs.
It is used to:
* Add a UUID line for each *msgid* in ``.pot`` files.
* Calculate similarity between new msgids and previously saved old msgids.
(This calculation can take a long time.)
.. tip::
If you want to accelerate the calculation,
you can use a third-party package (Levenshtein_) by running
:command:`pip install levenshtein`.
.. _Levenshtein: https://pypi.org/project/Levenshtein/
.. versionadded:: 1.3
.. confval:: gettext_location
:type: :code-py:`bool`
:default: :code-py:`True`
If :code-py:`True`, Sphinx generates location information
for messages in message catalogs.
.. versionadded:: 1.3
.. confval:: gettext_auto_build
:type: :code-py:`bool`
:default: :code-py:`True`
If :code-py:`True`, Sphinx builds a ``.mo`` file
for each translation catalog file.
.. versionadded:: 1.3
.. confval:: gettext_additional_targets
:type: :code-py:`set[str] | Sequence[str]`
:default: :code-py:`[]`
Enable ``gettext`` translation for certain element types.
Example:
.. code-block:: python
gettext_additional_targets = {'literal-block', 'image'}
The following element types are supported:
* :code-py:`'index'` -- index terms
* :code-py:`'literal-block'` -- literal blocks
(``::`` annotation and ``code-block`` directive)
* :code-py:`'doctest-block'` -- doctest block
* :code-py:`'raw'` -- raw content
* :code-py:`'image'` -- image/figure uri
.. versionadded:: 1.3
.. versionchanged:: 4.0
The alt text for images is translated by default.
.. versionchanged:: 7.4
Permit and prefer a set type.
.. confval:: figure_language_filename
:type: :code-py:`str`
:default: :code-py:`'{root}.{language}{ext}'`
The filename format for language-specific figures.
The available format tokens are:
* ``{root}``: the filename, including any path component,
without the file extension.
For example: ``images/filename``.
* ``{path}``: the directory path component of the filename,
with a trailing slash if non-empty.
For example: ``images/``.
* ``{basename}``: the filename without the directory path
or file extension components.
For example: ``filename``.
* ``{ext}``: the file extension.
For example: ``.png``.
* ``{language}``: the translation language.
For example: ``en``.
* ``{docpath}``: the directory path component for the current document,
with a trailing slash if non-empty.
For example: ``dirname/``.
By default, an image directive :code-rst:`.. image:: images/filename.png`,
using an image at :file:`images/filename.png`,
will use the language-specific figure filename
:file:`images/filename.en.png`.
If :confval:`!figure_language_filename` is set as below,
the language-specific figure filename will be
:file:`images/en/filename.png` instead.
.. code-block:: python
figure_language_filename = '{path}{language}/{basename}{ext}'
.. versionadded:: 1.4
.. versionchanged:: 1.5
Added ``{path}`` and ``{basename}`` tokens.
.. versionchanged:: 3.2
Added ``{docpath}`` token.
.. confval:: translation_progress_classes
:type: :code-py:`bool | 'translated' | 'untranslated'`
:default: :code-py:`False`
Control which, if any, classes are added to indicate translation progress.
This setting would likely only be used by translators of documentation,
in order to quickly indicate translated and untranslated content.
:code-py:`True`
Add ``translated`` and ``untranslated`` classes
to all nodes with translatable content.
:code-py:`'translated'`
Only add the ``translated`` class.
:code-py:`'untranslated'`
Only add the ``untranslated`` class.
:code-py:`False`
Do not add any classes to indicate translation progress.
.. versionadded:: 7.1
Options for markup
------------------
.. confval:: default_role
:type: :code-py:`str`
:default: :code-py:`None`
.. index:: default; role
The name of a reStructuredText role (builtin or Sphinx extension)
to use as the default role, that is, for text marked up ```like this```.
This can be set to :code-py:`'py:obj'` to make ```filter```
a cross-reference to the Python function "filter".
The default role can always be set within individual documents using
the standard reStructuredText :dudir:`default-role` directive.
.. versionadded:: 0.4
.. confval:: keep_warnings
:type: :code-py:`bool`
:default: :code-py:`False`
Keep warnings as "system message" paragraphs in the rendered documents.
Warnings are always written to the standard error stream
when :program:`sphinx-build` is run, regardless of this setting.
.. versionadded:: 0.5
.. confval:: option_emphasise_placeholders
:type: :code-py:`bool`
:default: :code-py:`False`
When enabled, emphasise placeholders in :rst:dir:`option` directives.
To display literal braces, escape with a backslash (``\{``).
For example, ``option_emphasise_placeholders=True``
and ``.. option:: -foption={TYPE}`` would render with ``TYPE`` emphasised.
.. versionadded:: 5.1
.. confval:: primary_domain
:type: :code-py:`str`
:default: :code-py:`'py'`
.. index:: pair: default; domain
The name of the default :doc:`domain </usage/domains/index>`.
Can also be :code-py:`None` to disable a default domain.
The default is :code-py:`'py'`, for the Python domain.
Those objects in other domain
(whether the domain name is given explicitly,
or selected by a :rst:dir:`default-domain` directive)
will have the domain name explicitly prepended when named
(e.g., when the default domain is C,
Python functions will be named "Python function", not just "function").
Example:
.. code-block:: python
primary_domain = 'cpp'
.. versionadded:: 1.0
.. confval:: rst_epilog
:type: :code-py:`str`
:default: :code-py:`''`
.. index:: pair: global; substitutions
A string of reStructuredText that will be included
at the end of every source file that is read.
This is a possible place to add substitutions that
should be available in every file (another being :confval:`rst_prolog`).
Example:
.. code-block:: python
rst_epilog = """
.. |psf| replace:: Python Software Foundation
"""
.. versionadded:: 0.6
.. confval:: rst_prolog
:type: :code-py:`str`
:default: :code-py:`''`
.. index:: pair: global; substitutions
A string of reStructuredText that will be included
at the beginning of every source file that is read.
This is a possible place to add substitutions that
should be available in every file (another being :confval:`rst_epilog`).
Example:
.. code-block:: python
rst_prolog = """
.. |psf| replace:: Python Software Foundation
"""
.. versionadded:: 1.0
.. confval:: show_authors
:type: :code-py:`bool`
:default: :code-py:`False`
A boolean that decides whether :rst:dir:`codeauthor` and
:rst:dir:`sectionauthor` directives produce any output in the built files.
.. confval:: trim_footnote_reference_space
:type: :code-py:`bool`
:default: :code-py:`False`
Trim spaces before footnote references that are
necessary for the reStructuredText parser to recognise the footnote,
but do not look too nice in the output.
.. versionadded:: 0.6
.. _math-options:
Options for Maths
-----------------
These options control maths markup and notation.
.. confval:: math_eqref_format
:type: :code-py:`str`
:default: :code-py:`'({number})'`
A string used for formatting the labels of references to equations.
The ``{number}`` place-holder stands for the equation number.
Example: ``'Eq.{number}'`` gets rendered as, for example, ``Eq.10``.
.. versionadded:: 1.7
.. confval:: math_number_all
:type: :code-py:`bool`
:default: :code-py:`False`
Force all displayed equations to be numbered.
Example:
.. code-block:: python
math_number_all = True
.. versionadded:: 1.4
.. confval:: math_numfig
:type: :code-py:`bool`
:default: :code-py:`True`
If :code-py:`True`, displayed math equations are numbered across pages
when :confval:`numfig` is enabled.
The :confval:`numfig_secnum_depth` setting is respected.
The :rst:role:`eq`, not :rst:role:`numref`, role
must be used to reference equation numbers.
.. versionadded:: 1.7
.. confval:: math_numsep
:type: :code-py:`str`
:default: :code-py:`'.'`
A string that defines the separator between section numbers
and the equation number when :confval:`numfig` is enabled and
:confval:`numfig_secnum_depth` is positive.
Example: :code-py:`'-'` gets rendered as ``1.2-3``.
.. versionadded:: 7.4
Options for the nitpicky mode
-----------------------------
.. confval:: nitpicky
:type: :code-py:`bool`
:default: :code-py:`False`
Enables nitpicky mode if :code-py:`True`.
In nitpicky mode, Sphinx will warn about *all* references
where the target cannot be found.
This is recommended for new projects as it ensures that all references
are to valid targets.
You can activate this mode temporarily using
the :option:`--nitpicky <sphinx-build --nitpicky>` command-line option.
See :confval:`nitpick_ignore` for a way to mark missing references
as "known missing".
.. code-block:: python
nitpicky = True
.. versionadded:: 1.0
.. confval:: nitpick_ignore
:type: :code-py:`set[tuple[str, str]] | Sequence[tuple[str, str]]`
:default: :code-py:`()`
A set or list of :code-py:`(warning_type, target)` tuples
that should be ignored when generating warnings
in :confval:`"nitpicky mode" <nitpicky>`.
Note that ``warning_type`` should include the domain name if present.
Example:
.. code-block:: python
nitpick_ignore = {
('py:func', 'int'),
('envvar', 'LD_LIBRARY_PATH'),
}
.. versionadded:: 1.1
.. versionchanged:: 6.2
Changed allowable container types to a set, list, or tuple
.. confval:: nitpick_ignore_regex
:type: :code-py:`set[tuple[str, str]] | Sequence[tuple[str, str]]`
:default: :code-py:`()`
An extended version of :confval:`nitpick_ignore`,
which instead interprets the ``warning_type`` and ``target`` strings
as regular expressions.
Note that the regular expression must match the whole string
(as if the ``^`` and ``$`` markers were inserted).
For example, ``(r'py:.*', r'foo.*bar\.B.*')`` will ignore nitpicky warnings
for all python entities that start with ``'foo'``
and have ``'bar.B'`` in them,
such as :code-py:`('py:const', 'foo_package.bar.BAZ_VALUE')`
or :code-py:`('py:class', 'food.bar.Barman')`.
.. versionadded:: 4.1
.. versionchanged:: 6.2
Changed allowable container types to a set, list, or tuple
Options for object signatures
-----------------------------
.. confval:: add_function_parentheses
:type: :code-py:`bool`
:default: :code-py:`True`
A boolean that decides whether parentheses are appended to function and
method role text (e.g. the content of ``:func:`input```) to signify that the
name is callable.
.. confval:: maximum_signature_line_length
:type: :code-py:`int | None`
:default: :code-py:`None`
If a signature's length in characters exceeds the number set,
each parameter within the signature will be displayed on
an individual logical line.
When :code-py:`None`, there is no maximum length and the entire
signature will be displayed on a single logical line.
A 'logical line' is similar to a hard line break---builders or themes
may choose to 'soft wrap' a single logical line,
and this setting does not affect that behaviour.
Domains may provide options to suppress any hard wrapping
on an individual object directive,
such as seen in the C, C++, and Python domains
(e.g. :rst:dir:`py:function:single-line-parameter-list`).
.. versionadded:: 7.1
.. confval:: strip_signature_backslash
:type: :code-py:`bool`
:default: :code-py:`False`
When backslash stripping is enabled then every occurrence of ``\\`` in a
domain directive will be changed to ``\``, even within string literals.
This was the behaviour before version 3.0, and setting this variable to
:code-py:`True` will reinstate that behaviour.
.. versionadded:: 3.0
.. confval:: toc_object_entries
:type: :code-py:`bool`
:default: :code-py:`True`
Create table of contents entries for domain objects
(e.g. functions, classes, attributes, etc.).
.. versionadded:: 5.2
.. confval:: toc_object_entries_show_parents
:type: :code-py:`'domain' | 'hide' | 'all'`
:default: :code-py:`'domain'`
A string that determines how domain objects
(functions, classes, attributes, etc.)
are displayed in their table of contents entry.
Use :code-py:`'domain'` to allow the domain to determine
the appropriate number of parents to show.
For example, the Python domain would show :code-py:`Class.method()`
and :code-py:`function()`,
leaving out the :code-py:`module.` level of parents.
Use :code-py:`'hide'` to only show the name of the element
without any parents (i.e. :code-py:`method()`).
Use :code-py:`'all'` to show the fully-qualified name for the object
(i.e. :code-py:`module.Class.method()`), displaying all parents.
.. versionadded:: 5.2
Options for source files
------------------------
.. confval:: exclude_patterns
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of `glob-style patterns`_ that should be excluded when looking for
source files.
They are matched against the source file names
relative to the source directory,
using slashes as directory separators on all platforms.
:confval:`exclude_patterns` has priority over :confval:`include_patterns`.
Example patterns:
* :code-py:`'library/xml.rst'` -- ignores the ``library/xml.rst`` file
* :code-py:`'library/xml'` -- ignores the ``library/xml`` directory
* :code-py:`'library/xml*'` -- ignores all files and directories starting with
:code-py:`library/xml`
* :code-py:`'**/.git'` -- ignores all ``.git`` directories
* :code-py:`'Thumbs.db'` -- ignores all ``Thumbs.db`` files
:confval:`exclude_patterns` is also consulted when looking for static files
in :confval:`html_static_path` and :confval:`html_extra_path`.
.. versionadded:: 1.0
.. confval:: include_patterns
:type: :code-py:`Sequence[str]`
:default: :code-py:`('**',)`
A list of `glob-style patterns`_ that are used to find source files.
They are matched against the source file
names relative to the source directory,
using slashes as directory separators on all platforms.
By default, all files are recursively included from the source directory.
:confval:`exclude_patterns` has priority over :confval:`include_patterns`.
Example patterns:
* :code-py:`'**'` -- all files in the source directory and subdirectories,
recursively
* :code-py:`'library/xml'` -- just the ``library/xml`` directory
* :code-py:`'library/xml*'` -- all files and directories starting with
``library/xml``
* :code-py:`'**/doc'` -- all ``doc`` directories (this might be useful if
documentation is co-located with source files)
.. versionadded:: 5.1
.. confval:: master_doc
root_doc
:type: :code-py:`str`
:default: :code-py:`'index'`
Sphinx builds a tree of documents based on the :rst:dir:`toctree` directives
contained within the source files.
This sets the name of the document containing the master ``toctree`` directive,
and hence the root of the entire tree.
Example:
.. code-block:: python
master_doc = 'contents'
.. versionchanged:: 2.0
Default is :code-py:`'index'` (previously :code-py:`'contents'`).
.. versionadded:: 4.0
The :confval:`!root_doc` alias.
.. confval:: source_encoding
:type: :code-py:`str`
:default: :code-py:`'utf-8-sig'`
The file encoding of all source files.
The recommended encoding is ``'utf-8-sig'``.
.. versionadded:: 0.5
.. confval:: source_suffix
:type: :code-py:`dict[str, str] | Sequence[str] | str`
:default: :code-py:`{'.rst': 'restructuredtext'}`
A dictionary mapping the file extensions (suffixes)
of source files to their file types.
Sphinx considers all files files with suffixes in :code-py:`source_suffix`
to be source files.
Example:
.. code-block:: python
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'restructuredtext',
'.md': 'markdown',
}
By default, Sphinx only supports the :code-py:`'restructuredtext'` file type.
Further file types can be added with extensions that register different
source file parsers, such as `MyST-Parser`_.
Refer to the extension's documentation to see which file types it supports.
.. _MyST-Parser: https://myst-parser.readthedocs.io/
If the value is a string or sequence of strings,
Sphinx will consider that they are all :code-py:`'restructuredtext'` files.
.. note:: File extensions must begin with a dot (``'.'``).
.. versionchanged:: 1.3
Support a list of file extensions.
.. versionchanged:: 1.8
Change to a map of file extensions to file types.
Options for smart quotes
------------------------
.. confval:: smartquotes
:type: :code-py:`bool`
:default: :code-py:`True`
If :code-py:`True`, the `Smart Quotes transform`__
will be used to convert quotation marks and dashes
to typographically correct entities.
__ https://docutils.sourceforge.io/docs/user/smartquotes.html
.. versionadded:: 1.6.6
Replaces the now-removed :confval:`!html_use_smartypants`.
It applies by default to all builders except ``man`` and ``text``
(see :confval:`smartquotes_excludes`.)
.. note::
A `docutils.conf`__ file located in the :term:`configuration directory`
(or a global :file:`~/.docutils` file) is obeyed unconditionally if it
*deactivates* smart quotes via the corresponding `Docutils option`__.
But if it *activates* them, then :confval:`smartquotes` does prevail.
__ https://docutils.sourceforge.io/docs/user/config.html
__ https://docutils.sourceforge.io/docs/user/config.html#smart-quotes
.. confval:: smartquotes_action
:type: :code-py:`str`
:default: :code-py:`'qDe'`
Customise the Smart Quotes transform.
See below for the permitted codes.
The default :code-py:`'qDe'` educates
normal **q**\ uote characters ``"``, ``'``,
em- and en-**D**\ ashes ``---``, ``--``,
and **e**\ llipses ``...``..
:code-py:`'q'`
Convert quotation marks
:code-py:`'b'`
Convert backtick quotation marks
(:literal:`\`\`double''` only)
:code-py:`'B'`
Convert backtick quotation marks
(:literal:`\`\`double''` and :literal:`\`single'`)
:code-py:`'d'`
Convert dashes
(convert ``--`` to em-dashes and ``---`` to en-dashes)
:code-py:`'D'`
Convert dashes (old school)
(convert ``--`` to en-dashes and ``---`` to em-dashes)
:code-py:`'i'`
Convert dashes (inverted old school)
(convert ``--`` to em-dashes and ``---`` to en-dashes)
:code-py:`'e'`
Convert ellipses ``...``
:code-py:`'w'`
Convert ``'"'`` entities to ``'"'``
.. versionadded:: 1.6.6
.. confval:: smartquotes_excludes
:type: :code-py:`dict[str, list[str]]`
:default: :code-py:`{'languages': ['ja'], 'builders': ['man', 'text']}`
Control when the Smart Quotes transform is disabled.
Permitted keys are :code-py:`'builders'` and :code-py:`'languages'`, and
The values are lists of strings.
Each entry gives a sufficient condition to ignore the
:confval:`smartquotes` setting and deactivate the Smart Quotes transform.
Example:
.. code-block:: python
smartquotes_excludes = {
'languages': ['ja'],
'builders': ['man', 'text'],
}
.. note::
Currently, in case of invocation of :program:`make` with multiple
targets, the first target name is the only one which is tested against
the :code-py:`'builders'` entry and it decides for all.
Also, a ``make text`` following ``make html`` needs to be issued
in the form ``make text SPHINXOPTS="-E"`` to force re-parsing
of source files, as the cached ones are already transformed.
On the other hand the issue does not arise with
direct usage of :program:`sphinx-build` as it caches
(in its default usage) the parsed source files in per builder locations.
.. hint::
An alternative way to effectively deactivate (or customise) the
smart quotes for a given builder, for example ``latex``,
is to use ``make`` this way:
.. code-block:: console
make latex SPHINXOPTS="-D smartquotes_action="
This can follow some ``make html`` with no problem, in contrast to the
situation from the prior note.
.. versionadded:: 1.6.6
Options for templating
----------------------
.. confval:: template_bridge
:type: :code-py:`str`
:default: :code-py:`''`
A string with the fully-qualified name of a callable (or simply a class)
that returns an instance of :class:`~sphinx.application.TemplateBridge`.
This instance is then used to render HTML documents,
and possibly the output of other builders (currently the changes builder).
(Note that the template bridge must be made theme-aware
if HTML themes are to be used.)
Example:
.. code-block:: python
template_bridge = 'module.CustomTemplateBridge'
.. confval:: templates_path
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of paths that contain extra templates
(or templates that overwrite builtin/theme-specific templates).
Relative paths are taken as relative to the :term:`configuration directory`.
Example:
.. code-block:: python
templates_path = ['.templates']
.. versionchanged:: 1.3
As these files are not meant to be built,
they are automatically excluded when discovering source files.
Options for warning control
---------------------------
.. confval:: show_warning_types
:type: :code-py:`bool`
:default: :code-py:`True`
Add the type of each warning as a suffix to the warning message.
For example, ``WARNING: [...] [index]`` or ``WARNING: [...] [toc.circular]``.
This setting can be useful for determining which warnings types to include
in a :confval:`suppress_warnings` list.
.. versionadded:: 7.3.0
.. versionchanged:: 8.0.0
The default is now :code-py:`True`.
.. confval:: suppress_warnings
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of warning codes to suppress arbitrary warning messages.
.. versionadded:: 1.4
By default, Sphinx supports the following warning codes:
* ``app.add_directive``
* ``app.add_generic_role``
* ``app.add_node``
* ``app.add_role``
* ``app.add_source_parser``
* ``config.cache``
* ``docutils``
* ``download.not_readable``
* ``duplicate_declaration.c``
* ``duplicate_declaration.cpp``
* ``epub.duplicated_toc_entry``
* ``epub.unknown_project_files``
* ``i18n.babel``
* ``i18n.inconsistent_references``
* ``i18n.not_readable``
* ``i18n.not_writeable``
* ``image.not_readable``
* ``index``
* ``misc.copy_overwrite``
* ``misc.highlighting_failure``
* ``ref.any``
* ``ref.citation``
* ``ref.doc``
* ``ref.footnote``
* ``ref.keyword``
* ``ref.numref``
* ``ref.option``
* ``ref.python``
* ``ref.ref``
* ``ref.term``
* ``toc.circular``
* ``toc.duplicate_entry``
* ``toc.empty_glob``
* ``toc.excluded``
* ``toc.no_title``
* ``toc.not_included``
* ``toc.not_readable``
* ``toc.secnum``
Extensions can also define their own warning types.
Those defined by the first-party ``sphinx.ext`` extensions are:
* ``autodoc``
* ``autodoc.import_object``
* ``autodoc.mocked_object``
* ``autosectionlabel.<document name>``
* ``autosummary``
* ``autosummary.import_cycle``
* ``intersphinx.external``
You can choose from these types. You can also give only the first
component to exclude all warnings attached to it.
.. versionadded:: 1.4
``ref.citation``, ``ref.doc``, ``ref.keyword``,
``ref.numref``, ``ref.option``, ``ref.ref``, and ``ref.term``.
.. versionadded:: 1.4.2
``app.add_directive``, ``app.add_generic_role``,
``app.add_node``, ``app.add_role``, and ``app.add_source_parser``.
.. versionadded:: 1.5
``misc.highlighting_failure``.
.. versionadded:: 1.5.1
``epub.unknown_project_files``.
.. versionadded:: 1.5.2
``toc.secnum``.
.. versionadded:: 1.6
``ref.footnote``, ``download.not_readable``, and ``image.not_readable``.
.. versionadded:: 1.7
``ref.python``.
.. versionadded:: 2.0
``autodoc.import_object``.
.. versionadded:: 2.1
``autosectionlabel.<document name>``.
.. versionadded:: 3.1
``toc.circular``.
.. versionadded:: 3.3
``epub.duplicated_toc_entry``.
.. versionadded:: 4.3
``toc.excluded`` and ``toc.not_readable``.
.. versionadded:: 4.5
``i18n.inconsistent_references``.
.. versionadded:: 7.1
``index``.
.. versionadded:: 7.3
``config.cache``, ``intersphinx.external``, and ``toc.no_title``.
.. versionadded:: 7.4
``docutils`` and ``autosummary.import_cycle``.
.. versionadded:: 8.0
``misc.copy_overwrite``.
.. versionadded:: 8.2
``autodoc.mocked_object``,
``duplicate_declaration.c``, ``duplicate_declaration.cpp``,
``i18n.babel``, ``i18n.not_readable``, ``i18n.not_writeable``,
``ref.any``,
``toc.duplicate_entry``, ``toc.empty_glob``, and ``toc.not_included``.
Builder options
===============
.. _html-options:
Options for HTML output
-----------------------
These options influence HTML output.
Various other builders are derived from the HTML output,
and also make use of these options.
.. confval:: html_theme
:type: :code-py:`str`
:default: :code-py:`'alabaster'`
The theme for HTML output.
See the :doc:`HTML theming section </usage/theming>`.
.. versionadded:: 0.6
.. versionchanged:: 1.3
The default theme is now :code-py:`'alabaster'`.
.. confval:: html_theme_options
:type: :code-py:`dict[str, Any]`
:default: :code-py:`{}`
A dictionary of options that influence the
look and feel of the selected theme.
These are theme-specific.
The options understood by the :ref:`builtin themes
<builtin-themes>` are described :ref:`here <builtin-themes>`.
.. versionadded:: 0.6
.. confval:: html_theme_path
:type: :code-py:`list[str]`
:default: :code-py:`[]`
A list of paths that contain custom themes,
either as subdirectories or as zip files.
Relative paths are taken as relative to the :term:`configuration directory`.
.. versionadded:: 0.6
.. confval:: html_style
:type: :code-py:`Sequence[str] | str`
:default: :code-py:`()`
Stylesheets to use for HTML pages.
The stylesheet given by the selected theme is used by default
A file of that name must exist either in Sphinx's :file:`static/` path
or in one of the custom paths given in :confval:`html_static_path`.
If you only want to add or override a few things from the theme,
use CSS ``@import`` to import the theme's stylesheet.
.. versionchanged:: 5.1
The value can be a iterable of strings.
.. confval:: html_title
:type: :code-py:`str`
:default: :samp:`'{project} {release} documentation'`
The "title" for HTML documentation generated with Sphinx's own templates.
This is appended to the ``<title>`` tag of individual pages,
and used in the navigation bar as the "topmost" element.
.. confval:: html_short_title
:type: :code-py:`str`
:default: The value of **html_title**
A shorter "title" for HTML documentation.
This is used for links in the header and in the HTML Help documentation.
.. versionadded:: 0.4
.. confval:: html_baseurl
:type: :code-py:`str`
:default: :code-py:`''`
The base URL which points to the root of the HTML documentation.
It is used to indicate the location of document using
:rfc:`the Canonical Link Relation <6596>`.
.. versionadded:: 1.8
.. confval:: html_codeblock_linenos_style
:type: :code-py:`'inline' | 'table'`
:default: :code-py:`'inline'`
The style of line numbers for code-blocks.
:code-py:`'table'`
Display line numbers using ``<table>`` tag
:code-py:`'inline'`
Display line numbers using ``<span>`` tag
.. versionadded:: 3.2
.. versionchanged:: 4.0
It defaults to :code-py:`'inline'`.
.. deprecated:: 4.0
.. confval:: html_context
:type: :code-py:`dict[str, Any]`
:default: :code-py:`{}`
A dictionary of values to pass into
the template engine's context for all pages.
Single values can also be put in this dictionary using
:program:`sphinx-build`'s :option:`--html-define
<sphinx-build --html-define>` command-line option.
.. versionadded:: 0.5
.. confval:: html_logo
:type: :code-py:`str`
:default: :code-py:`''`
If given, this must be the name of an image file
(path relative to the :term:`configuration directory`)
that is the logo of the documentation,
or a URL that points an image file for the logo.
It is placed at the top of the sidebar;
its width should therefore not exceed 200 pixels.
.. versionadded:: 0.4.1
The image file will be copied to the ``_static`` directory,
but only if the file does not already exist there.
.. versionchanged:: 4.0
Also accepts a URL.
.. confval:: html_favicon
:type: :code-py:`str`
:default: :code-py:`''`
If given, this must be the name of an image file
(path relative to the :term:`configuration directory`)
that is the favicon_ of the documentation,
or a URL that points an image file for the favicon.
Browsers use this as the icon for tabs, windows and bookmarks.
It should be a 16-by-16 pixel icon in
the PNG, SVG, GIF, or ICO file formats.
.. _favicon: https://developer.mozilla.org/en-US/
docs/Web/HTML/Attributes/rel#icon
Example:
.. code-block:: python
html_favicon = 'static/favicon.png'
.. versionadded:: 0.4
The image file will be copied to the ``_static``,
but only if the file does not already exist there.
.. versionchanged:: 4.0
Also accepts the URL for the favicon.
.. confval:: html_css_files
:type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
:default: :code-py:`[]`
A list of CSS files.
The entry must be a *filename* string
or a tuple containing the *filename* string and the *attributes* dictionary.
The *filename* must be relative to the :confval:`html_static_path`,
or a full URI with scheme like :code-py:`'https://example.org/style.css'`.
The *attributes* dictionary is used for the ``<link>`` tag's attributes.
Example:
.. code-block:: python
html_css_files = [
'custom.css',
'https://example.com/css/custom.css',
('print.css', {'media': 'print'}),
]
The special attribute *priority* can be set as an integer
to load the CSS file at an earlier or later step.
For more information, refer to :meth:`.Sphinx.add_css_file`.
.. versionadded:: 1.8
.. versionchanged:: 3.5
Support the *priority* attribute
.. confval:: html_js_files
:type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
:default: :code-py:`[]`
A list of JavaScript files.
The entry must be a *filename* string
or a tuple containing the *filename* string and the *attributes* dictionary.
The *filename* must be relative to the :confval:`html_static_path`,
or a full URI with scheme like :code-py:`'https://example.org/script.js'`.
The *attributes* dictionary is used for the ``<script>`` tag's attributes.
Example:
.. code-block:: python
html_js_files = [
'script.js',
'https://example.com/scripts/custom.js',
('custom.js', {'async': 'async'}),
]
As a special attribute, *priority* can be set as an integer
to load the JavaScript file at an earlier or later step.
For more information, refer to :meth:`.Sphinx.add_js_file`.
.. versionadded:: 1.8
.. versionchanged:: 3.5
Support the *priority* attribute
.. confval:: html_static_path
:type: :code-py:`list[str]`
:default: :code-py:`[]`
A list of paths that contain custom static files
(such as style sheets or script files).
Relative paths are taken as relative to the :term:`configuration directory`.
They are copied to the output's :file:`_static` directory
after the theme's static files,
so a file named :file:`default.css` will overwrite
the theme's :file:`default.css`.
As these files are not meant to be built,
they are automatically excluded from source files.
.. note::
For security reasons, dotfiles under :confval:`!html_static_path`
will not be copied.
If you would like to copy them intentionally,
explicitly add each file to this setting:
.. code-block:: python
html_static_path = ['_static', '_static/.htaccess']
An alternative approach is to use :confval:`html_extra_path`,
which allows copying dotfiles under the directories.
.. versionchanged:: 0.4
The paths in :confval:`html_static_path` can now contain subdirectories.
.. versionchanged:: 1.0
The entries in :confval:`html_static_path` can now be single files.
.. versionchanged:: 1.8
The files under :confval:`html_static_path` are excluded from source
files.
.. confval:: html_extra_path
:type: :code-py:`list[str]`
:default: :code-py:`[]`
A list of paths that contain extra files not directly related to
the documentation,
such as :file:`robots.txt` or :file:`.htaccess`.
Relative paths are taken as relative to the :term:`configuration directory`.
They are copied to the output directory.
They will overwrite any existing file of the same name.
As these files are not meant to be built,
they are automatically excluded from source files.
.. versionadded:: 1.2
.. versionchanged:: 1.4
The dotfiles in the extra directory will be copied
to the output directory.
And it refers :confval:`exclude_patterns` on copying extra
files and directories, and ignores if path matches to patterns.
.. confval:: html_last_updated_fmt
:type: :code-py:`str`
:default: :code-py:`None`
If set, a 'Last updated on:' timestamp is inserted into the page footer
using the given :func:`~time.strftime` format.
The empty string is equivalent to :code-py:`'%b %d, %Y'`
(or a locale-dependent equivalent).
.. confval:: html_last_updated_use_utc
:type: :code-py:`bool`
:default: :code-py:`False`
Use GMT/UTC (+00:00) instead of the system's local time zone
for the time supplied to :confval:`html_last_updated_fmt`.
This is most useful when the format used includes the time.
.. confval:: html_permalinks
:type: :code-py:`bool`
:default: :code-py:`True`
Add link anchors for each heading and description environment.
.. versionadded:: 3.5
.. confval:: html_permalinks_icon
:type: :code-py:`str`
:default: :code-py:`'¶'` (the paragraph sign)
Text for link anchors for each heading and description environment.
HTML entities and Unicode are allowed.
.. versionadded:: 3.5
.. confval:: html_sidebars
:type: :code-py:`dict[str, Sequence[str]]`
:default: :code-py:`{}`
A dictionary defining custom sidebar templates,
mapping document names to template names.
The keys can contain `glob-style patterns`_,
in which case all matching documents will get the specified sidebars.
(A warning is emitted when a more than one glob-style pattern
matches for any document.)
Each value must be a list of strings which specifies
the complete list of sidebar templates to include.
If all or some of the default sidebars are to be included,
they must be put into this list as well.
The default sidebars (for documents that don't match any pattern) are
defined by theme itself.
The builtin themes use these templates by default:
:code-py:`'localtoc.html'`, :code-py:`'relations.html'`,
:code-py:`'sourcelink.html'`, and :code-py:`'searchbox.html'`.
The bundled first-party sidebar templates that can be rendered are:
* **localtoc.html** -- a fine-grained table of contents of the current
document
* **globaltoc.html** -- a coarse-grained table of contents for the whole
documentation set, collapsed
* **relations.html** -- two links to the previous and next documents
* **sourcelink.html** -- a link to the source of the current document,
if enabled in :confval:`html_show_sourcelink`
* **searchbox.html** -- the "quick search" box
Example:
.. code-block:: python
html_sidebars = {
'**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html'],
'using/windows': ['windows-sidebar.html', 'searchbox.html'],
}
This will render the custom template ``windows-sidebar.html`` and the quick
search box within the sidebar of the given document, and render the default
sidebars for all other pages (except that the local TOC is replaced by the
global TOC).
Note that this value only has no effect if
the chosen theme does not possess a sidebar,
like the builtin **scrolls** and **haiku** themes.
.. versionadded:: 1.0
The ability to use globbing keys and to specify multiple sidebars.
.. deprecated:: 1.7
A single string value for :confval:`!html_sidebars` will be removed.
.. versionchanged:: 2.0
:confval:`!html_sidebars` must be a list of strings,
and no longer accepts a single string value.
.. confval:: html_additional_pages
:type: :code-py:`dict[str, str]`
:default: :code-py:`{}`
Additional templates that should be rendered to HTML pages,
must be a dictionary that maps document names to template names.
Example:
.. code-block:: python
html_additional_pages = {
'download': 'custom-download.html.jinja',
}
This will render the template :file:`custom-download.html.jinja`
as the page :file:`download.html`.
.. confval:: html_domain_indices
:type: :code-py:`bool | Sequence[str]`
:default: :code-py:`True`
If True, generate domain-specific indices in addition to the general index.
For e.g. the Python domain, this is the global module index.
This value can be a Boolean or a list of index names that should be generated.
To find out the index name for a specific index, look at the HTML file name.
For example, the Python module index has the name ``'py-modindex'``.
Example:
.. code-block:: python
html_domain_indices = {
'py-modindex',
}
.. versionadded:: 1.0
.. versionchanged:: 7.4
Permit and prefer a set type.
.. confval:: html_use_index
:type: :code-py:`bool`
:default: :code-py:`True`
Controls if an index is added to the HTML documents.
.. versionadded:: 0.4
.. confval:: html_split_index
:type: :code-py:`bool`
:default: :code-py:`False`
Generates two versions of the index:
once as a single page with all the entries,
and once as one page per starting letter.
.. versionadded:: 0.4
.. confval:: html_copy_source
:type: :code-py:`bool`
:default: :code-py:`True`
If True, the reStructuredText sources are included in the HTML build as
:file:`_sources/{docname}`.
.. confval:: html_show_sourcelink
:type: :code-py:`bool`
:default: :code-py:`True`
If True (and :confval:`html_copy_source` is true as well),
links to the reStructuredText sources will be added to the sidebar.
.. versionadded:: 0.6
.. confval:: html_sourcelink_suffix
:type: :code-py:`str`
:default: :code-py:`'.txt'`
The suffix to append to source links
(see :confval:`html_show_sourcelink`),
unless files they have this suffix already.
.. versionadded:: 1.5
.. confval:: html_use_opensearch
:type: :code-py:`str`
:default: :code-py:`''`
If nonempty, an `OpenSearch <https://github.com/dewitt/opensearch>`_
description file will be output,
and all pages will contain a ``<link>`` tag referring to it.
Since OpenSearch doesn't support relative URLs for its search page location,
the value of this option must be the base URL
from which these documents are served (without trailing slash),
e.g. :code-py:`'https://docs.python.org'`.
.. versionadded:: 0.2
.. confval:: html_file_suffix
:type: :code-py:`str`
:default: :code-py:`'.html'`
The file name suffix (file extension) for generated HTML files.
.. versionadded:: 0.4
.. confval:: html_link_suffix
:type: :code-py:`str`
:default: The value of **html_file_suffix**
The suffix for generated links to HTML files.
Intended to support more esoteric server setups.
.. versionadded:: 0.6
.. confval:: html_show_copyright
:type: :code-py:`bool`
:default: :code-py:`True`
If True, "© Copyright ..." is shown in the HTML footer,
with the value or values from :confval:`copyright`.
.. versionadded:: 1.0
.. confval:: html_show_search_summary
:type: :code-py:`bool`
:default: :code-py:`True`
Show a summary of the search result, i.e., the text around the keyword.
.. versionadded:: 4.5
.. confval:: html_show_sphinx
:type: :code-py:`bool`
:default: :code-py:`True`
Add "Created using Sphinx_" to the HTML footer.
.. _Sphinx: https://www.sphinx-doc.org/
.. versionadded:: 0.4
.. confval:: html_output_encoding
:type: :code-py:`str`
:default: :code-py:`'utf-8'`
Encoding of HTML output files.
This encoding name must both be a valid Python encoding name
and a valid HTML ``charset`` value.
.. versionadded:: 1.0
.. confval:: html_compact_lists
:type: :code-py:`bool`
:default: :code-py:`True`
If True, a list all whose items consist of a single paragraph and/or a
sub-list all whose items etc... (recursive definition) will not use the
``<p>`` element for any of its items. This is standard docutils behaviour.
Default: :code-py:`True`.
.. versionadded:: 1.0
.. confval:: html_secnumber_suffix
:type: :code-py:`str`
:default: :code-py:`'. '`
Suffix for section numbers in HTML output.
Set to :code-py:`' '` to suppress the final dot on section numbers.
.. versionadded:: 1.0
.. confval:: html_search_language
:type: :code-py:`str`
:default: The value of **language**
Language to be used for generating the HTML full-text search index.
This defaults to the global language selected with :confval:`language`.
English (:code-py:`'en'`) is used as a fall-back option
if there is no support for this language.
Support exists for the following languages:
* ``da`` -- Danish
* ``nl`` -- Dutch
* ``en`` -- English
* ``fi`` -- Finnish
* ``fr`` -- French
* ``de`` -- German
* ``hu`` -- Hungarian
* ``it`` -- Italian
* ``ja`` -- Japanese
* ``no`` -- Norwegian
* ``pt`` -- Portuguese
* ``ro`` -- Romanian
* ``ru`` -- Russian
* ``es`` -- Spanish
* ``sv`` -- Swedish
* ``tr`` -- Turkish
* ``zh`` -- Chinese
.. tip:: Accelerating build speed
Each language (except Japanese) provides its own stemming algorithm.
Sphinx uses a Python implementation by default.
If you want to accelerate building the index file,
you can use a third-party package (PyStemmer_) by running
:command:`pip install PyStemmer`.
.. _PyStemmer: https://pypi.org/project/PyStemmer/
.. versionadded:: 1.1
Support English (``en``) and Japanese (``ja``).
.. versionchanged:: 1.3
Added additional languages.
.. confval:: html_search_options
:type: :code-py:`dict[str, str]`
:default: :code-py:`{}`
A dictionary with options for the search language support.
The meaning of these options depends on the language selected.
Currently, only Japanese and Chinese support options.
:Japanese:
``type`` -- the type of the splitter to use.
The other options depend on the splitter used.
:code-py:`'sphinx.search.ja.DefaultSplitter'`
The TinySegmenter algorithm, used by default.
:code-py:`'sphinx.search.ja.MecabSplitter'`:
The MeCab binding
To use this splitter, the 'mecab' python binding
or dynamic link library
('libmecab.so' for Linux, 'libmecab.dll' for Windows) is required.
:code-py:`'sphinx.search.ja.JanomeSplitter'`:
The Janome binding.
To use this splitter,
`Janome <https://pypi.org/project/Janome/>`_ is required.
.. deprecated:: 1.6
``'mecab'``, ``'janome'`` and ``'default'`` is deprecated.
To keep compatibility,
``'mecab'``, ``'janome'`` and ``'default'`` are also acceptable.
Options for :code-py:`'mecab'`:
:dic_enc:
_`dic_enc option` is the encoding for the MeCab algorithm.
:dict:
_`dict option` is the dictionary to use for the MeCab algorithm.
:lib:
_`lib option` is the library name for finding the MeCab library
via ``ctypes`` if the Python binding is not installed.
For example:
.. code-block:: python
html_search_options = {
'type': 'mecab',
'dic_enc': 'utf-8',
'dict': '/path/to/mecab .dic',
'lib': '/path/to/libmecab.so',
}
Options for :code-py:`'janome'`:
:user_dic:
_`user_dic option` is the user dictionary file path for Janome.
:user_dic_enc:
_`user_dic_enc option` is the encoding for
the user dictionary file specified by ``user_dic`` option.
Default is 'utf8'.
:Chinese:
``dict``
The ``jieba`` dictionary path for using a custom dictionary.
.. versionadded:: 1.1
.. versionchanged:: 1.4
Allow any custom splitter in the *type* setting for Japanese.
.. confval:: html_search_scorer
:type: :code-py:`str`
:default: :code-py:`''`
The name of a JavaScript file
(relative to the :term:`configuration directory`)
that implements a search results scorer.
If empty, the default will be used.
The scorer must implement the following interface,
and may optionally define the :code-js:`score()` function
for more granular control.
.. code-block:: javascript
const Scorer = {
// Implement the following function to further tweak the score for each result
score: result => {
const [docName, title, anchor, descr, score, filename] = result
// ... calculate a new score ...
return score
},
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {
0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5, // used to be unimportantResults
},
// Used when the priority is not in the mapping.
objPrioDefault: 0,
// query found in title
title: 15,
partialTitle: 7,
// query found in terms
term: 5,
partialTerm: 2,
};
.. versionadded:: 1.2
.. confval:: html_scaled_image_link
:type: :code-py:`bool`
:default: :code-py:`True`
Link images that have been resized with a
scale option (*scale*, *width*, or *height*)
to their original full-resolution image.
This will not overwrite any link given by the *target* option
on the the :dudir:`image` directive, if present.
.. tip::
To disable this feature on a per-image basis,
add the ``no-scaled-link`` class to the image directive:
.. code-block:: rst
.. image:: sphinx.png
:scale: 50%
:class: no-scaled-link
.. versionadded:: 1.3
.. versionchanged:: 3.0
Images with the ``no-scaled-link`` class will not be linked.
.. confval:: html_math_renderer
:type: :code-py:`str`
:default: :code-py:`'mathjax'`
The maths renderer to use for HTML output.
The bundled renders are *mathjax* and *imgmath*.
You must also load the relevant extension in :confval:`extensions`.
.. versionadded:: 1.8
Options for Single HTML output
-------------------------------
These options influence Single HTML output.
This builder derives from the HTML builder,
so the HTML options also apply where appropriate.
.. confval:: singlehtml_sidebars
:type: :code-py:`dict[str, Sequence[str]]`
:default: The value of **html_sidebars**
A dictionary defining custom sidebar templates,
mapping document names to template names.
This has the same effect as :confval:`html_sidebars`,
but the only permitted key is :code-py:`'index'`,
and all other keys are ignored.
.. _htmlhelp-options:
Options for HTML help output
-----------------------------
These options influence HTML help output.
This builder derives from the HTML builder,
so the HTML options also apply where appropriate.
.. confval:: htmlhelp_basename
:type: :code-py:`str`
:default: :code-py:`'{project}doc'`
Output file base name for HTML help builder.
The default is the :confval:`project name <project>`
with spaces removed and ``doc`` appended.
.. confval:: htmlhelp_file_suffix
:type: :code-py:`str`
:default: :code-py:`'.html'`
This is the file name suffix for generated HTML help files.
.. versionadded:: 2.0
.. confval:: htmlhelp_link_suffix
:type: :code-py:`str`
:default: The value of **htmlhelp_file_suffix**
Suffix for generated links to HTML files.
.. versionadded:: 2.0
.. _applehelp-options:
Options for Apple Help output
-----------------------------
.. versionadded:: 1.3
These options influence Apple Help output.
This builder derives from the HTML builder,
so the HTML options also apply where appropriate.
.. note::
Apple Help output will only work on Mac OS X 10.6 and higher,
as it requires the :program:`hiutil` and :program:`codesign`
command-line tools, neither of which are Open Source.
You can disable the use of these tools using
:confval:`applehelp_disable_external_tools`,
but the result will not be a valid help book
until the indexer is run over the ``.lproj`` directories within the bundle.
.. TODO: Is this warning still relevant as of 2024-07?
Needs updating by someone with a Mac.
.. confval:: applehelp_bundle_name
:type: :code-py:`str`
:default: The value of **project**
The basename for the Apple Help Book.
The default is the :confval:`project name <project>`
with spaces removed.
.. confval:: applehelp_bundle_id
:type: :code-py:`str`
:default: :code-py:`None`
The bundle ID for the help book bundle.
.. warning::
You *must* set this value in order to generate Apple Help.
.. confval:: applehelp_bundle_version
:type: :code-py:`str`
:default: :code-py:`'1'`
The bundle version, as a string.
.. confval:: applehelp_dev_region
:type: :code-py:`str`
:default: :code-py:`'en-us'`
The development region.
Defaults to Apple’s recommended setting, :code-py:`'en-us'`.
.. confval:: applehelp_icon
:type: :code-py:`str`
:default: :code-py:`None`
Path to the help bundle icon file or :code-py:`None` for no icon.
According to Apple's documentation,
this should be a 16-by-16 pixel version of the application's icon
with a transparent background, saved as a PNG file.
.. confval:: applehelp_kb_product
:type: :code-py:`str`
:default: :samp:`'{project}-{release}'`
The product tag for use with :confval:`applehelp_kb_url`.
.. confval:: applehelp_kb_url
:type: :code-py:`str`
:default: :code-py:`None`
The URL for your knowledgebase server,
e.g. ``https://example.com/kbsearch.py?p='product'&q='query'&l='lang'``.
At runtime, Help Viewer will replace
``'product'`` with the contents of :confval:`applehelp_kb_product`,
``'query'`` with the text entered by the user in the search box,
and ``'lang'`` with the user's system language.
Set this to to :code-py:`None` to disable remote search.
.. confval:: applehelp_remote_url
:type: :code-py:`str`
:default: :code-py:`None`
The URL for remote content.
You can place a copy of your Help Book's ``Resources`` directory
at this location and Help Viewer will attempt to use it
to fetch updated content.
For example, if you set it to ``https://example.com/help/Foo/``
and Help Viewer wants a copy of ``index.html`` for
an English speaking customer,
it will look at ``https://example.com/help/Foo/en.lproj/index.html``.
Set this to to :code-py:`None` for no remote content.
.. confval:: applehelp_index_anchors
:type: :code-py:`bool`
:default: :code-py:`False`
Tell the help indexer to index anchors in the generated HTML.
This can be useful for jumping to a particular topic
using the ``AHLookupAnchor`` function
or the ``openHelpAnchor:inBook:`` method in your code.
It also allows you to use ``help:anchor`` URLs;
see the Apple documentation for more information on this topic.
.. confval:: applehelp_min_term_length
:type: :code-py:`str`
:default: :code-py:`None`
Controls the minimum term length for the help indexer.
If :code-py:`None`, use the default length.
.. confval:: applehelp_stopwords
:type: :code-py:`str`
:default: The value of **language**
Either a language specification (to use the built-in stopwords),
or the path to a stopwords plist,
or :code-py:`None` if you do not want to use stopwords.
The default stopwords plist can be found at
``/usr/share/hiutil/Stopwords.plist``
and contains, at time of writing, stopwords for the following languages:
* German (``de``)
* English (``en``)
* Spanish (``es``)
* French (``fr``)
* Hungarian (``hu``)
* Italian (``it``)
* Swedish (``sv``)
.. confval:: applehelp_locale
:type: :code-py:`str`
:default: The value of **language**
Specifies the locale to generate help for.
This is used to determine the name of the ``.lproj`` directory
inside the Help Book’s ``Resources``,
and is passed to the help indexer.
.. confval:: applehelp_title
:type: :code-py:`str`
:default: :samp:`'{project} Help'`
Specifies the help book title.
.. confval:: applehelp_codesign_identity
:type: :code-py:`str`
:default: The value of **CODE_SIGN_IDENTITY**
Specifies the identity to use for code signing.
Use :code-py:`None` if code signing is not to be performed.
Defaults to the value of the :envvar:`!CODE_SIGN_IDENTITY`
environment variable, which is set by Xcode for script build phases,
or :code-py:`None` if that variable is not set.
.. confval:: applehelp_codesign_flags
:type: :code-py:`list[str]`
:default: The value of **OTHER_CODE_SIGN_FLAGS**
A *list* of additional arguments to pass to :program:`codesign` when
signing the help book.
Defaults to a list based on the value of the :envvar:`!OTHER_CODE_SIGN_FLAGS`
environment variable, which is set by Xcode for script build phases,
or the empty list if that variable is not set.
.. confval:: applehelp_codesign_path
:type: :code-py:`str`
:default: :code-py:`'/usr/bin/codesign'`
The path to the :program:`codesign` program.
.. confval:: applehelp_indexer_path
:type: :code-py:`str`
:default: :code-py:`'/usr/bin/hiutil'`
The path to the :program:`hiutil` program.
.. confval:: applehelp_disable_external_tools
:type: :code-py:`bool`
:default: :code-py:`False`
Do not run the indexer or the code signing tool,
no matter what other settings are specified.
This is mainly useful for testing,
or where you want to run the Sphinx build on a non-macOS platform
and then complete the final steps on a Mac for some reason.
.. _epub-options:
Options for EPUB output
-----------------------
These options influence EPUB output.
This builder derives from the HTML builder,
so the HTML options also apply where appropriate.
.. note::
The actual value for some of these options is not important,
but they are required for the `Dublin Core metadata`_.
.. _Dublin Core metadata: https://dublincore.org/
.. confval:: epub_basename
:type: :code-py:`str`
:default: The value of **project**
The basename for the EPUB file.
.. confval:: epub_theme
:type: :code-py:`str`
:default: :code-py:`'epub'`
The HTML theme for the EPUB output. Since the default themes are not
optimised for small screen space, using the same theme for HTML and EPUB
output is usually not wise.
This defaults to :code-py:`'epub'`,
a theme designed to save visual space.
.. confval:: epub_theme_options
:type: :code-py:`dict[str, Any]`
:default: :code-py:`{}`
A dictionary of options that influence the
look and feel of the selected theme.
These are theme-specific.
The options understood by the :ref:`builtin themes
<builtin-themes>` are described :ref:`here <builtin-themes>`.
.. versionadded:: 1.2
.. confval:: epub_title
:type: :code-py:`str`
:default: The value of **project**
The title of the document.
.. versionchanged:: 2.0
It defaults to the :confval:`!project` option
(previously :confval:`!html_title`).
.. confval:: epub_description
:type: :code-py:`str`
:default: :code-py:`'unknown'`
The description of the document.
.. versionadded:: 1.4
.. versionchanged:: 1.5
Renamed from :confval:`!epub3_description`
.. confval:: epub_author
:type: :code-py:`str`
:default: The value of **author**
The author of the document.
This is put in the Dublin Core metadata.
.. confval:: epub_contributor
:type: :code-py:`str`
:default: :code-py:`'unknown'`
The name of a person, organisation, etc. that played a secondary role
in the creation of the content of an EPUB Publication.
.. versionadded:: 1.4
.. versionchanged:: 1.5
Renamed from :confval:`!epub3_contributor`
.. confval:: epub_language
:type: :code-py:`str`
:default: The value of **language**
The language of the document.
This is put in the Dublin Core metadata.
.. confval:: epub_publisher
:type: :code-py:`str`
:default: The value of **author**
The publisher of the document.
This is put in the Dublin Core metadata.
You may use any sensible string, e.g. the project homepage.
.. confval:: epub_copyright
:type: :code-py:`str`
:default: The value of **copyright**
The copyright of the document.
See :confval:`copyright` for permitted formats.
.. confval:: epub_identifier
:type: :code-py:`str`
:default: :code-py:`'unknown'`
An identifier for the document.
This is put in the Dublin Core metadata.
For published documents this is the ISBN number,
but you can also use an alternative scheme, e.g. the project homepage.
.. confval:: epub_scheme
:type: :code-py:`str`
:default: :code-py:`'unknown'`
The publication scheme for the :confval:`epub_identifier`.
This is put in the Dublin Core metadata.
For published books the scheme is ``'ISBN'``.
If you use the project homepage, ``'URL'`` seems reasonable.
.. confval:: epub_uid
:type: :code-py:`str`
:default: :code-py:`'unknown'`
A unique identifier for the document.
This is put in the Dublin Core metadata.
You may use a `XML's Name format`_ string.
You can't use hyphen, period, numbers as a first character.
.. _XML's Name format: https://www.w3.org/TR/REC-xml/#NT-NameStartChar
.. confval:: epub_cover
:type: :code-py:`tuple[str, str]`
:default: :code-py:`()`
The cover page information.
This is a tuple containing the filenames of the cover image
and the html template.
The rendered html cover page is inserted as the first item
in the spine in :file:`content.opf`.
If the template filename is empty, no html cover page is created.
No cover at all is created if the tuple is empty.
Examples:
.. code-block:: python
epub_cover = ('_static/cover.png', 'epub-cover.html')
epub_cover = ('_static/cover.png', '')
epub_cover = ()
.. versionadded:: 1.1
.. confval:: epub_css_files
:type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
:default: :code-py:`[]`
A list of CSS files.
The entry must be a *filename* string
or a tuple containing the *filename* string and the *attributes* dictionary.
The *filename* must be relative to the :confval:`html_static_path`,
or a full URI with scheme like :code-py:`'https://example.org/style.css'`.
The *attributes* dictionary is used for the ``<link>`` tag's attributes.
For more information, see :confval:`html_css_files`.
.. versionadded:: 1.8
.. confval:: epub_guide
:type: :code-py:`Sequence[tuple[str, str, str]]`
:default: :code-py:`()`
Meta data for the guide element of :file:`content.opf`.
This is a sequence of tuples containing
the *type*, the *uri* and the *title* of the optional guide information.
See `the OPF documentation <https://idpf.org/epub>`_ for details.
If possible, default entries for the *cover* and *toc* types
are automatically inserted.
However, the types can be explicitly overwritten
if the default entries are not appropriate.
Example:
.. code-block:: python
epub_guide = (
('cover', 'cover.html', 'Cover Page'),
)
The default value is :code-py:`()`.
.. confval:: epub_pre_files
:type: :code-py:`Sequence[tuple[str, str]]`
:default: :code-py:`()`
Additional files that should be inserted before the text generated by Sphinx.
It is a list of tuples containing the file name and the title.
If the title is empty, no entry is added to :file:`toc.ncx`.
Example:
.. code-block:: python
epub_pre_files = [
('index.html', 'Welcome'),
]
.. confval:: epub_post_files
:type: :code-py:`Sequence[tuple[str, str]]`
:default: :code-py:`()`
Additional files that should be inserted after the text generated by Sphinx.
It is a list of tuples containing the file name and the title.
This option can be used to add an appendix.
If the title is empty, no entry is added to :file:`toc.ncx`.
Example:
.. code-block:: python
epub_post_files = [
('appendix.xhtml', 'Appendix'),
]
.. confval:: epub_exclude_files
:type: :code-py:`Sequence[str]`
:default: :code-py:`[]`
A sequence of files that are generated/copied in the build directory
but should not be included in the EPUB file.
.. confval:: epub_tocdepth
:type: :code-py:`int`
:default: :code-py:`3`
The depth of the table of contents in the file :file:`toc.ncx`.
It should be an integer greater than zero.
.. tip::
A deeply nested table of contents may be difficult to navigate.
.. confval:: epub_tocdup
:type: :code-py:`bool`
:default: :code-py:`True`
This flag determines if a ToC entry is inserted again
at the beginning of its nested ToC listing.
This allows easier navigation to the top of a chapter,
but can be confusing because it mixes entries of different depth in one list.
.. confval:: epub_tocscope
:type: :code-py:`'default' | 'includehidden'`
:default: :code-py:`'default'`
This setting control the scope of the EPUB table of contents.
The setting can have the following values:
:code-py:`'default'`
Include all ToC entries that are not hidden
:code-py:`'includehidden'`
Include all ToC entries
.. versionadded:: 1.2
.. confval:: epub_fix_images
:type: :code-py:`bool`
:default: :code-py:`False`
Try and fix image formats that are not supported by some EPUB readers.
At the moment palette images with a small colour table are upgraded.
This is disabled by default because the
automatic conversion may lose information.
You need the Python Image Library (Pillow_) installed to use this option.
.. _Pillow: https://pypi.org/project/Pillow/
.. versionadded:: 1.2
.. confval:: epub_max_image_width
:type: :code-py:`int`
:default: :code-py:`0`
This option specifies the maximum width of images.
If it is set to a valuevgreater than zero,
images with a width larger than the given value are scaled accordingly.
If it is zero, no scaling is performed.
You need the Python Image Library (Pillow_) installed to use this option.
.. _Pillow: https://pypi.org/project/Pillow/
.. versionadded:: 1.2
.. confval:: epub_show_urls
:type: :code-py:`'footnote' | 'no' | 'inline'`
:default: :code-py:`'footnote'`
Control how to display URL addresses.
This is very useful for readers that have no other means
to display the linked URL.
The setting can have the following values:
:code-py:`'inline'`
Display URLs inline in parentheses.
:code-py:`'footnote'`
Display URLs in footnotes.
:code-py:`'no'`
Do not display URLs.
The display of inline URLs can be customised by adding CSS rules
for the class ``link-target``.
.. versionadded:: 1.2
.. confval:: epub_use_index
:type: :code-py:`bool`
:default: The value of **html_use_index**
Add an index to the EPUB document.
.. versionadded:: 1.2
.. confval:: epub_writing_mode
:type: :code-py:`'horizontal' | 'vertical'`
:default: :code-py:`'horizontal'`
It specifies writing direction.
It can accept :code-py:`'horizontal'` and :code-py:`'vertical'`
.. list-table::
:align: left
:header-rows: 1
:stub-columns: 1
* - ``epub_writing_mode``
- ``'horizontal'``
- ``'vertical'``
* - writing-mode_
- ``horizontal-tb``
- ``vertical-rl``
* - page progression
- left to right
- right to left
* - iBook's Scroll Theme support
- scroll-axis is vertical.
- scroll-axis is horizontal.
.. _writing-mode: https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode
.. _latex-options:
Options for LaTeX output
------------------------
These options influence LaTeX output.
.. confval:: latex_engine
:type: :code-py:`'pdflatex' | 'xelatex' | 'lualatex' | 'platex' | 'uplatex'`
:default: :code-py:`'pdflatex'`
The LaTeX engine to build the documentation.
The setting can have the following values:
* :code-py:`'pdflatex'` -- PDFLaTeX (default)
* :code-py:`'xelatex'` -- XeLaTeX
(default if :confval:`language` is one of ``el``, ``zh_CN``, or ``zh_TW``)
* :code-py:`'lualatex'` -- LuaLaTeX
* :code-py:`'platex'` -- pLaTeX
* :code-py:`'uplatex'` -- upLaTeX
(default if :confval:`language` is :code-py:`'ja'`)
.. important::
``'pdflatex'``\ 's support for Unicode characters is limited.
If your project uses Unicode characters,
setting the engine to ``'xelatex'`` or ``'lualatex'``
and making sure to use an OpenType font with wide-enough glyph coverage
is often easier than trying to make ``'pdflatex'`` work
with the extra Unicode characters.
Since Sphinx 2.0, the default typeface is GNU FreeFont,
which has good coverage of Latin, Cyrillic, and Greek glyphs.
.. note::
Sphinx 2.0 adds support for occasional Cyrillic and Greek letters or
words in documents using a Latin language and ``'pdflatex'``. To enable
this, the :ref:`fontenc` key of :ref:`latex_elements
<latex_elements_confval>` must be used appropriately.
.. note::
Contrarily to :ref:`MathJaX math rendering in HTML output <math-support>`,
LaTeX requires some extra configuration to support Unicode literals in
:rst:dir:`math`:
the only comprehensive solution (as far as we know) is to
use ``'xelatex'`` or ``'lualatex'`` *and* to add
``r'\usepackage{unicode-math}'``
(e.g. via the :ref:`preamble` key of :ref:`latex_elements
<latex_elements_confval>`).
You may prefer ``r'\usepackage[math-style=literal]{unicode-math}'``
to keep a Unicode literal such as ``α`` (U+03B1) as-is in output,
rather than being rendered as :math:`\alpha`.
.. versionchanged:: 2.1.0
Use ``'xelatex'`` (and LaTeX package ``xeCJK``)
by default for Chinese documents.
.. versionchanged:: 2.2.1
Use ``'xelatex'`` by default for Greek documents.
.. versionchanged:: 2.3
Add ``'uplatex'`` support.
.. versionchanged:: 4.0
Use ``'uplatex'`` by default for Japanese documents.
.. confval:: latex_documents
:type: :code-py:`Sequence[tuple[str, str, str, str, str, bool]]`
:default: The default LaTeX documents
This value determines how to group the document tree
into LaTeX source files.
It must be a list of tuples ``(startdocname, targetname, title, author,
theme, toctree_only)``,
where the items are:
*startdocname*
String that specifies the :term:`document name` of
the LaTeX file's master document.
All documents referenced by the *startdoc* document in
ToC trees will be included in the LaTeX file.
(If you want to use the default master document for your LaTeX build,
provide your :confval:`master_doc` here.)
*targetname*
File name of the LaTeX file in the output directory.
*title*
LaTeX document title.
Can be empty to use the title of the *startdoc* document.
This is inserted as LaTeX markup,
so special characters like a backslash or ampersand
must be represented by the proper LaTeX commands
if they are to be inserted literally.
*author*
Author for the LaTeX document.
The same LaTeX markup caveat as for *title* applies.
Use ``\\and`` to separate multiple authors, as in: ``'John \\and Sarah'``
(backslashes must be Python-escaped to reach LaTeX).
*theme*
LaTeX theme.
See :confval:`latex_theme`.
*toctree_only*
Must be :code-py:`True` or :code-py:`False`.
If True, the *startdoc* document itself is not included in the output,
only the documents referenced by it via ToC trees.
With this option, you can put extra stuff in the master document
that shows up in the HTML, but not the LaTeX output.
.. versionadded:: 0.3
The 6th item ``toctree_only``.
Tuples with 5 items are still accepted.
.. versionadded:: 1.2
In the past including your own document class required you to prepend the
document class name with the string "sphinx".
This is not necessary anymore.
.. confval:: latex_logo
:type: :code-py:`str`
:default: :code-py:`''`
If given, this must be the name of an image file
(path relative to the :term:`configuration directory`)
that is the logo of the documentation.
It is placed at the top of the title page.
.. confval:: latex_toplevel_sectioning
:type: :code-py:`'part' | 'chapter' | 'section'`
:default: :code-py:`None`
This value determines the topmost sectioning unit. The default setting is
``'section'`` if :confval:`latex_theme` is ``'howto'``, and ``'chapter'``
if it is ``'manual'``. The alternative in both cases is to specify
``'part'``, which means that LaTeX document will use the :code-tex:`\\part`
command.
In that case the numbering of sectioning units one level deep gets off-sync
with HTML numbering, as by default LaTeX does not reset
:code-tex:`\\chapter` numbering (or :code-tex:`\\section` for ``'howto'``
theme) when encountering :code-tex:`\\part` command.
.. versionadded:: 1.4
.. confval:: latex_appendices
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of document names to append as an appendix to all manuals.
This is ignored if :confval:`latex_theme` is set to :code-py:`'howto'`.
.. confval:: latex_domain_indices
:type: :code-py:`bool | Sequence[str]`
:default: :code-py:`True`
If True, generate domain-specific indices in addition to the general index.
For e.g. the Python domain, this is the global module index.
This value can be a Boolean or a list of index names that should be generated.
To find out the index name for a specific index, look at the HTML file name.
For example, the Python module index has the name ``'py-modindex'``.
Example:
.. code-block:: python
latex_domain_indices = {
'py-modindex',
}
.. versionadded:: 1.0
.. versionchanged:: 7.4
Permit and prefer a set type.
.. confval:: latex_show_pagerefs
:type: :code-py:`bool`
:default: :code-py:`False`
Add page references after internal references.
This is very useful for printed copies of the manual.
.. versionadded:: 1.0
.. confval:: latex_show_urls
:type: :code-py:`'no' | 'footnote' | 'inline'`
:default: :code-py:`'no'`
Control how to display URL addresses.
This is very useful for printed copies of the manual.
The setting can have the following values:
:code-py:`'no'`
Do not display URLs
:code-py:`'footnote'`
Display URLs in footnotes
:code-py:`'inline'`
Display URLs inline in parentheses
.. versionadded:: 1.0
.. versionchanged:: 1.1
This value is now a string; previously it was a boolean value,
and a true value selected the :code-py:`'inline'` display.
For backwards compatibility, :code-py:`True` is still accepted.
.. confval:: latex_use_latex_multicolumn
:type: :code-py:`bool`
:default: :code-py:`False`
Use standard LaTeX's :code-tex:`\\multicolumn` for merged cells in tables.
:code-py:`False`
Sphinx's own macros are used for merged cells from grid tables.
They allow general contents (literal blocks, lists, blockquotes, ...)
but may have problems if the :rst:dir:`tabularcolumns` directive
was used to inject LaTeX mark-up of the type
``>{..}``, ``<{..}``, ``@{..}`` as column specification.
:code-py:`True`
Use LaTeX's standard :code-tex:`\\multicolumn`;
this is incompatible with literal blocks in horizontally merged cells,
and also with multiple paragraphs in such cells
if the table is rendered using ``tabulary``.
.. versionadded:: 1.6
.. confval:: latex_table_style
:type: :code-py:`list[str]`
:default: :code-py:`['booktabs', 'colorrows']`
A list of styling classes (strings).
Currently supported:
:code-py:`'booktabs'`
No vertical lines, and only 2 or 3 horizontal lines
(the latter if there is a header),
using the booktabs_ package.
:code-py:`'borderless'`
No lines whatsoever.
:code-py:`'colorrows'`
The table rows are rendered with alternating background colours.
The interface to customise them is via
:ref:`dedicated keys <tablecolors>` of :ref:`latexsphinxsetup`.
.. important::
With the :code-py:`'colorrows'` style,
the :code-tex:`\\rowcolors` LaTeX command becomes a no-op
(this command has limitations and has never correctly
supported all types of tables Sphinx produces in LaTeX).
Please update your project to use the
:ref:`latex table color configuration <tablecolors>` keys instead.
To customise the styles for a table,
use the ``:class:`` option if the table is defined using a directive,
or otherwise insert a :ref:`rst-class <rstclass>` directive before the table
(cf. :ref:`table-directives`).
Currently recognised classes are ``booktabs``, ``borderless``,
``standard``, ``colorrows``, ``nocolorrows``.
The latter two can be combined with any of the first three.
The ``standard`` class produces tables with
both horizontal and vertical lines
(as has been the default so far with Sphinx).
A single-row multi-column merged cell will obey the row colour,
if it is set.
See also ``TableMergeColor{Header,Odd,Even}``
in the :ref:`latexsphinxsetup` section.
.. note::
* It is hard-coded in LaTeX that a single cell will obey the row colour
even if there is a column colour set via :code-tex:`\\columncolor`
from a column specification (see :rst:dir:`tabularcolumns`).
Sphinx provides :code-tex:`\\sphinxnorowcolor` which can be used
in a table column specification like this:
.. code-block:: latex
>{\columncolor{blue}\sphinxnorowcolor}
* Sphinx also provides :code-tex:`\\sphinxcolorblend`,
which however requires the xcolor_ package.
Here is an example:
.. code-block:: latex
>{\sphinxcolorblend{!95!red}}
It means that in this column,
the row colours will be slightly tinted by red;
refer to xcolor_ documentation for more on the syntax of its
:code-tex:`\\blendcolors` command
(a :code-tex:`\\blendcolors` in place of :code-tex:`\\sphinxcolorblend`
would modify colours of the cell *contents*,
not of the cell *background colour panel*...).
You can find an example of usage in the :ref:`dev-deprecated-apis`
section of this document in PDF format.
.. hint::
If you want to use a special colour for the *contents* of the
cells of a given column use ``>{\noindent\color{<color>}}``,
possibly in addition to the above.
* Multi-row merged cells, whether single column or multi-column
currently ignore any set column, row, or cell colour.
* It is possible for a simple cell to set a custom colour via the
:dudir:`raw` directive and
the :code-tex:`\\cellcolor` LaTeX command used
anywhere in the cell contents.
This currently is without effect in a merged cell, whatever its kind.
.. hint::
In a document not using ``'booktabs'`` globally,
it is possible to style an individual table via the ``booktabs`` class,
but it will be necessary to add ``r'\usepackage{booktabs}'``
to the LaTeX preamble.
On the other hand one can use ``colorrows`` class for individual tables
with no extra package (as Sphinx since 5.3.0 always loads colortbl_).
.. _booktabs: https://ctan.org/pkg/booktabs
.. _colortbl: https://ctan.org/pkg/colortbl
.. _xcolor: https://ctan.org/pkg/xcolor
.. versionadded:: 5.3.0
.. versionchanged:: 6.0.0
Modify default from :code-py:`[]` to :code-py:`['booktabs', 'colorrows']`.
.. confval:: latex_use_xindy
:type: :code-py:`bool`
:default: :code-py:`True if latex_engine in {'xelatex', 'lualatex'} else False`
Use Xindy_ to prepare the index of general terms.
By default, the LaTeX builder uses :program:`makeindex`
for preparing the index of general terms .
Using Xindy_ means that words with UTF-8 characters will be
ordered correctly for the :confval:`language`.
.. _Xindy: https://xindy.sourceforge.net/
* This option is ignored if :confval:`latex_engine` is :code-py:`'platex'`
(Japanese documents;
:program:`mendex` replaces :program:`makeindex` then).
* The default is :code-py:`True`
for :code-py:`'xelatex'` or :code-py:`'lualatex'` as
:program:`makeindex` creates ``.ind`` files containing invalid bytes
for the UTF-8 encoding if any indexed term starts with
a non-ASCII character.
With :code-py:`'lualatex'` this then breaks the PDF build.
* The default is :code-py:`False` for :code-py:`'pdflatex'`,
but :code-py:`True` is recommended for non-English documents as soon
as some indexed terms use non-ASCII characters from the language script.
Attempting to index a term whose first character is non-ASCII
will break the build, if :confval:`latex_use_xindy` is left to its
default :code-py:`False`.
Sphinx adds some dedicated support to the :program:`xindy` base distribution
for using :code-py:`'pdflatex'` engine with Cyrillic scripts.
With both :code-py:`'pdflatex'` and Unicode engines,
Cyrillic documents handle the indexing of Latin names correctly,
even those having diacritics.
.. versionadded:: 1.8
.. confval:: latex_elements
:type: :code-py:`dict[str, str]`
:default: :code-py:`{}`
.. versionadded:: 0.5
:ref:`See the full documentation for latex_elements <latex_elements_confval>`.
.. confval:: latex_docclass
:type: :code-py:`dict[str, str]`
:default: :code-py:`{}`
A dictionary mapping :code-py:`'howto'` and :code-py:`'manual'`
to names of real document classes that will be used as the base
for the two Sphinx classes.
Default is to use :code-py:`'article'` for :code-py:`'howto'`
and :code-py:`'report'` for :code-py:`'manual'`.
.. versionadded:: 1.0
.. versionchanged:: 1.5
In Japanese documentation (:confval:`language` is :code-py:`'ja'`),
by default :code-py:`'jreport'` is used for :code-py:`'howto'`
and :code-py:`'jsbook'` for :code-py:`'manual'`.
.. confval:: latex_additional_files
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of file names, relative to the :term:`configuration directory`,
to copy to the build directory when building LaTeX output.
This is useful to copy files that Sphinx doesn't copy automatically,
or to overwrite Sphinx LaTeX support files with custom versions.
Image files that are referenced in source files (e.g. via ``.. image::``)
are copied automatically and should not be listed there.
.. attention::
Filenames with the ``.tex`` extension will be automatically
handed over to the PDF build process triggered by
:option:`sphinx-build -M latexpdf <sphinx-build -M>`
or by :program:`make latexpdf`.
If the file was added only to be :code-tex:`\\input{}`
from a modified preamble,
you must add a further suffix such as ``.txt`` to the filename
and adjust the :code-tex:`\\input{}` macro accordingly.
.. versionadded:: 0.6
.. versionchanged:: 1.2
This overrides the files provided from Sphinx such as ``sphinx.sty``.
.. confval:: latex_theme
:type: :code-py:`str`
:default: :code-py:`'manual'`
The "theme" that the LaTeX output should use.
It is a collection of settings for LaTeX output
(e.g. document class, top level sectioning unit and so on).
The bundled first-party LaTeX themes are *manual* and *howto*:
``manual``
A LaTeX theme for writing a manual.
It imports the ``report`` document class
(Japanese documents use ``jsbook``).
``howto``
A LaTeX theme for writing an article.
It imports the ``article`` document class
(Japanese documents use ``jreport``).
:confval:`latex_appendices` is only available for this theme.
.. versionadded:: 3.0
.. confval:: latex_theme_options
:type: :code-py:`dict[str, Any]`
:default: :code-py:`{}`
A dictionary of options that influence the
look and feel of the selected theme.
These are theme-specific.
.. versionadded:: 3.1
.. confval:: latex_theme_path
:type: :code-py:`list[str]`
:default: :code-py:`[]`
A list of paths that contain custom LaTeX themes as subdirectories.
Relative paths are taken as relative to the :term:`configuration directory`.
.. versionadded:: 3.0
.. _text-options:
Options for text output
-----------------------
These options influence text output.
.. confval:: text_add_secnumbers
:type: :code-py:`bool`
:default: :code-py:`True`
Include section numbers in text output.
.. versionadded:: 1.7
.. confval:: text_newlines
:type: :code-py:`'unix' | 'windows' | 'native'`
:default: :code-py:`'unix'`
Determines which end-of-line character(s) are used in text output.
:code-py:`'unix'`
Use Unix-style line endings (``\n``).
:code-py:`'windows'`
Use Windows-style line endings (``\r\n``).
:code-py:`'native'`
Use the line ending style of the platform the documentation is built on.
.. versionadded:: 1.1
.. confval:: text_secnumber_suffix
:type: :code-py:`str`
:default: :code-py:`'. '`
Suffix for section numbers in text output.
Set to :code-py:`' '` to suppress the final dot on section numbers.
.. versionadded:: 1.7
.. confval:: text_sectionchars
:type: :code-py:`str`
:default: :code-py:`'*=-~"+\`'`
A string of 7 characters that should be used for underlining sections.
The first character is used for first-level headings,
the second for second-level headings and so on.
.. versionadded:: 1.1
.. _man-options:
Options for manual page output
------------------------------
These options influence manual page output.
.. confval:: man_pages
:type: :code-py:`Sequence[tuple[str, str, str, str, str]]`
:default: The default manual pages
This value determines how to group the document tree
into manual pages.
It must be a list of tuples
``(startdocname, name, description, authors, section)``,
where the items are:
*startdocname*
String that specifies the :term:`document name` of
the manual page's master document.
All documents referenced by the *startdoc* document in
ToC trees will be included in the manual page.
(If you want to use the default master document for your manual pages build,
provide your :confval:`master_doc` here.)
*name*
Name of the manual page.
This should be a short string without spaces or special characters.
It is used to determine the file name as well as the
name of the manual page (in the NAME section).
*description*
Description of the manual page.
This is used in the NAME section.
Can be an empty string if you do not want to
automatically generate the NAME section.
*authors*
A list of strings with authors, or a single string.
Can be an empty string or list if you do not want to
automatically generate an AUTHORS section in the manual page.
*section*
The manual page section.
Used for the output file name as well as in the manual page header.
.. versionadded:: 1.0
.. confval:: man_show_urls
:type: :code-py:`bool`
:default: :code-py:`False`
Add URL addresses after links.
.. versionadded:: 1.1
.. confval:: man_make_section_directory
:type: :code-py:`bool`
:default: :code-py:`True`
Make a section directory on build man page.
.. versionadded:: 3.3
.. versionchanged:: 4.0
The default is now :code-py:`False` (previously :code-py:`True`).
.. versionchanged:: 4.0.2
Revert the change in the default.
.. _texinfo-options:
Options for Texinfo output
--------------------------
These options influence Texinfo output.
.. confval:: texinfo_documents
:type: :code-py:`Sequence[tuple[str, str, str, str, str, str, str, bool]]`
:default: The default Texinfo documents
This value determines how to group the document tree
into Texinfo source files.
It must be a list of tuples ``(startdocname, targetname, title, author,
dir_entry, description, category, toctree_only)``,
where the items are:
*startdocname*
String that specifies the :term:`document name` of
the Texinfo file's master document.
All documents referenced by the *startdoc* document in
ToC trees will be included in the Texinfo file.
(If you want to use the default master document for your Texinfo build,
provide your :confval:`master_doc` here.)
*targetname*
File name (no extension) of the Texinfo file in the output directory.
*title*
Texinfo document title.
Can be empty to use the title of the *startdoc*
document. Inserted as Texinfo markup,
so special characters like ``@`` and ``{}`` will need to
be escaped to be inserted literally.
*author*
Author for the Texinfo document.
Inserted as Texinfo markup.
Use ``@*`` to separate multiple authors, as in: ``'John@*Sarah'``.
*dir_entry*
The name that will appear in the top-level ``DIR`` menu file.
*description*
Descriptive text to appear in the top-level ``DIR`` menu file.
*category*
Specifies the section which this entry will appear in the top-level
``DIR`` menu file.
*toctree_only*
Must be :code-py:`True` or :code-py:`False`.
If True, the *startdoc* document itself is not included in the output,
only the documents referenced by it via ToC trees.
With this option, you can put extra stuff in the master document
that shows up in the HTML, but not the Texinfo output.
.. versionadded:: 1.1
.. confval:: texinfo_appendices
:type: :code-py:`Sequence[str]`
:default: :code-py:`[]`
A list of document names to append as an appendix to all manuals.
.. versionadded:: 1.1
.. confval:: texinfo_cross_references
:type: :code-py:`bool`
:default: :code-py:`True`
Generate inline references in a document.
Disabling inline references can make an info file more readable
with a stand-alone reader (``info``).
.. versionadded:: 4.4
.. confval:: texinfo_domain_indices
:type: :code-py:`bool | Sequence[str]`
:default: :code-py:`True`
If True, generate domain-specific indices in addition to the general index.
For e.g. the Python domain, this is the global module index.
This value can be a Boolean or a list of index names that should be generated.
To find out the index name for a specific index, look at the HTML file name.
For example, the Python module index has the name ``'py-modindex'``.
Example:
.. code-block:: python
texinfo_domain_indices = {
'py-modindex',
}
.. versionadded:: 1.1
.. versionchanged:: 7.4
Permit and prefer a set type.
.. confval:: texinfo_elements
:type: :code-py:`dict[str, Any]`
:default: :code-py:`{}`
A dictionary that contains Texinfo snippets that override those that
Sphinx usually puts into the generated ``.texi`` files.
* Keys that you may want to override include:
``'paragraphindent'``
Number of spaces to indent the first line of each paragraph,
default ``2``.
Specify ``0`` for no indentation.
``'exampleindent'``
Number of spaces to indent the lines for examples or literal blocks,
default ``4``.
Specify ``0`` for no indentation.
``'preamble'``
Texinfo markup inserted near the beginning of the file.
``'copying'``
Texinfo markup inserted within the ``@copying`` block
and displayed after the title.
The default value consists of a simple title page identifying the project.
* Keys that are set by other options
and therefore should not be overridden are
``'author'``, ``'body'``, ``'date'``, ``'direntry'``
``'filename'``, ``'project'``, ``'release'``, and ``'title'``.
.. versionadded:: 1.1
.. confval:: texinfo_no_detailmenu
:type: :code-py:`bool`
:default: :code-py:`False`
Do not generate a ``@detailmenu`` in the "Top" node's menu
containing entries for each sub-node in the document.
.. versionadded:: 1.2
.. confval:: texinfo_show_urls
:type: :code-py:`'footnote' | 'no' | 'inline'`
:default: :code-py:`'footnote'`
Control how to display URL addresses.
The setting can have the following values:
:code-py:`'footnote'`
Display URLs in footnotes.
:code-py:`'no'`
Do not display URLs.
:code-py:`'inline'`
Display URLs inline in parentheses.
.. versionadded:: 1.1
.. _qthelp-options:
Options for QtHelp output
--------------------------
These options influence qthelp output.
This builder derives from the HTML builder,
so the HTML options also apply where appropriate.
.. confval:: qthelp_basename
:type: :code-py:`str`
:default: The value of **project**
The basename for the qthelp file.
.. confval:: qthelp_namespace
:type: :code-py:`str`
:default: :code-py:`'org.sphinx.{project_name}.{project_version}'`
The namespace for the qthelp file.
.. confval:: qthelp_theme
:type: :code-py:`str`
:default: :code-py:`'nonav'`
The HTML theme for the qthelp output.
.. confval:: qthelp_theme_options
:type: :code-py:`dict[str, Any]`
:default: :code-py:`{}`
A dictionary of options that influence the
look and feel of the selected theme.
These are theme-specific.
The options understood by the :ref:`builtin themes
<builtin-themes>` are described :ref:`here <builtin-themes>`.
Options for XML output
----------------------
.. confval:: xml_pretty
:type: :code-py:`bool`
:default: :code-py:`True`
Pretty-print the XML.
.. versionadded:: 1.2
Options for the linkcheck builder
---------------------------------
Filtering
~~~~~~~~~
These options control which links the *linkcheck* builder checks,
and which failures and redirects it ignores.
.. confval:: linkcheck_allowed_redirects
:type: :code-py:`dict[str, str]`
:default: :code-py:`{}`
A dictionary that maps a pattern of the source URI
to a pattern of the canonical URI.
The *linkcheck* builder treats the redirected link as "working" when:
* the link in the document matches the source URI pattern, and
* the redirect location matches the canonical URI pattern.
The *linkcheck* builder will emit a warning when
it finds redirected links that don't meet the rules above.
It can be useful to detect unexpected redirects when using
:option:`the fail-on-warnings mode <sphinx-build --fail-on-warning>`.
Example:
.. code-block:: python
linkcheck_allowed_redirects = {
# All HTTP redirections from the source URI to
# the canonical URI will be treated as "working".
r'https://sphinx-doc\.org/.*': r'https://sphinx-doc\.org/en/master/.*'
}
.. versionadded:: 4.1
.. confval:: linkcheck_anchors
:type: :code-py:`bool`
:default: :code-py:`True`
Check the validity of ``#anchor``\ s in links.
Since this requires downloading the whole document,
it is considerably slower when enabled.
.. versionadded:: 1.2
.. confval:: linkcheck_anchors_ignore
:type: :code-py:`Sequence[str]`
:default: :code-py:`["^!"]`
A list of regular expressions that match anchors that the *linkcheck* builder
should skip when checking the validity of anchors in links.
For example, this allows skipping anchors added by a website's JavaScript.
.. tip::
Use :confval:`linkcheck_anchors_ignore_for_url` to check a URL,
but skip verifying that the anchors exist.
.. note::
If you want to ignore anchors of a specific page or
of pages that match a specific pattern
(but still check occurrences of the same page(s) that don't have anchors),
use :confval:`linkcheck_ignore` instead,
for example as follows:
.. code-block:: python
linkcheck_ignore = [
'https://www.sphinx-doc.org/en/1.7/intro.html#',
]
.. versionadded:: 1.5
.. confval:: linkcheck_anchors_ignore_for_url
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list or tuple of regular expressions matching URLs
for which the *linkcheck* builder should not check the validity of anchors.
This allows skipping anchor checks on a per-page basis
while still checking the validity of the page itself.
.. versionadded:: 7.1
.. confval:: linkcheck_exclude_documents
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of regular expressions that match documents in which
the *linkcheck* builder should not check the validity of links.
This can be used for permitting link decay
in legacy or historical sections of the documentation.
Example:
.. code-block:: python
# ignore all links in documents located in a subdirectory named 'legacy'
linkcheck_exclude_documents = [r'.*/legacy/.*']
.. versionadded:: 4.4
.. confval:: linkcheck_ignore
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of regular expressions that match URIs that should not be checked
when doing a ``linkcheck`` build.
Server-issued redirects that match :confval:`ignored URIs <linkcheck_ignore>`
will not be followed.
Example:
.. code-block:: python
linkcheck_ignore = [r'https://localhost:\d+/']
.. versionadded:: 1.1
HTTP Requests
~~~~~~~~~~~~~
These options control how the *linkcheck* builder makes HTTP requests,
including how it handles redirects and authentication,
and the number of workers to use.
.. confval:: linkcheck_auth
:type: :code-py:`Sequence[tuple[str, Any]]`
:default: :code-py:`[]`
Pass authentication information when doing a ``linkcheck`` build.
A list of :code-py:`(regex_pattern, auth_info)` tuples where the items are:
*regex_pattern*
A regular expression that matches a URI.
*auth_info*
Authentication information to use for that URI.
The value can be anything that is understood by the ``requests`` library
(see :ref:`requests authentication <requests:authentication>` for details).
The *linkcheck* builder will use the first matching ``auth_info`` value
it can find in the :confval:`!linkcheck_auth` list,
so values earlier in the list have higher priority.
Example:
.. code-block:: python
linkcheck_auth = [
('https://foo\.yourcompany\.com/.+', ('johndoe', 'secret')),
('https://.+\.yourcompany\.com/.+', HTTPDigestAuth(...)),
]
.. versionadded:: 2.3
.. confval:: linkcheck_allow_unauthorized
:type: :code-py:`bool`
:default: :code-py:`False`
When a webserver responds with an HTTP 401 (unauthorised) response,
the current default behaviour of the *linkcheck* builder is
to treat the link as "broken".
To change that behaviour, set this option to :code-py:`True`.
.. versionchanged:: 8.0
The default value for this option changed to :code-py:`False`,
meaning HTTP 401 responses to checked hyperlinks
are treated as "broken" by default.
.. versionadded:: 7.3
.. confval:: linkcheck_rate_limit_timeout
:type: :code-py:`int`
:default: :code-py:`300`
The *linkcheck* builder may issue a large number of requests to the same
site over a short period of time.
This setting controls the builder behaviour
when servers indicate that requests are rate-limited,
by setting the maximum duration (in seconds) that the builder will
wait for between each attempt before recording a failure.
The *linkcheck* builder always respects a server's direction
of when to retry (using the `Retry-After`_ header).
Otherwise, ``linkcheck`` waits for a minute before to retry and keeps
doubling the wait time between attempts until it succeeds or exceeds the
:confval:`!linkcheck_rate_limit_timeout` (in seconds).
Custom timeouts should be given as a number of seconds.
.. _Retry-After: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.3
.. versionadded:: 3.4
.. confval:: linkcheck_report_timeouts_as_broken
:type: :code-py:`bool`
:default: :code-py:`False`
If :confval:`linkcheck_timeout` expires while waiting for a response from
a hyperlink, the *linkcheck* builder will report the link as a ``timeout``
by default. To report timeouts as ``broken`` instead, you can
set :confval:`linkcheck_report_timeouts_as_broken` to :code-py:`True`.
.. versionchanged:: 8.0
The default value for this option changed to :code-py:`False`,
meaning timeouts that occur while checking hyperlinks
will be reported using the new 'timeout' status code.
.. versionadded:: 7.3
.. confval:: linkcheck_request_headers
:type: :code-py:`dict[str, dict[str, str]]`
:default: :code-py:`{}`
A dictionary that maps URL (without paths) to HTTP request headers.
The key is a URL base string like :code-py:`'https://www.sphinx-doc.org/'`.
To specify headers for other hosts, :code-py:`"*"` can be used.
It matches all hosts only when the URL does not match other settings.
The value is a dictionary that maps header name to its value.
Example:
.. code-block:: python
linkcheck_request_headers = {
"https://www.sphinx-doc.org/": {
"Accept": "text/html",
"Accept-Encoding": "utf-8",
},
"*": {
"Accept": "text/html,application/xhtml+xml",
}
}
.. versionadded:: 3.1
.. confval:: linkcheck_retries
:type: :code-py:`int`
:default: :code-py:`1`
The number of times the *linkcheck* builder
will attempt to check a URL before declaring it broken.
.. versionadded:: 1.4
.. confval:: linkcheck_timeout
:type: :code-py:`int`
:default: :code-py:`30`
The duration, in seconds, that the *linkcheck* builder
will wait for a response after each hyperlink request.
.. versionadded:: 1.1
.. confval:: linkcheck_workers
:type: :code-py:`int`
:default: :code-py:`5`
The number of worker threads to use when checking links.
.. versionadded:: 1.1
Domain options
==============
.. _c-config:
Options for the C domain
------------------------
.. confval:: c_extra_keywords
:type: :code-py:`Set[str] | Sequence[str]`
:default: :code-py:`['alignas', 'alignof', 'bool',
'complex', 'imaginary', 'noreturn',
'static_assert', 'thread_local']`
A list of identifiers to be recognised as keywords by the C parser.
.. versionadded:: 4.0.3
.. versionchanged:: 7.4
:confval:`!c_extra_keywords` can now be a set.
.. confval:: c_id_attributes
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A sequence of strings that the parser should additionally accept
as attributes.
For example, this can be used when :code-c:`#define`
has been used for attributes, for portability.
Example:
.. code-block:: python
c_id_attributes = [
'my_id_attribute',
]
.. versionadded:: 3.0
.. versionchanged:: 7.4
:confval:`!c_id_attributes` can now be a tuple.
.. confval:: c_maximum_signature_line_length
:type: :code-py:`int | None`
:default: :code-py:`None`
If a signature's length in characters exceeds the number set,
each parameter within the signature will be displayed on
an individual logical line.
When :code-py:`None`, there is no maximum length and the entire
signature will be displayed on a single logical line.
This is a domain-specific setting,
overriding :confval:`maximum_signature_line_length`.
.. versionadded:: 7.1
.. confval:: c_paren_attributes
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A sequence of strings that the parser should additionally accept
as attributes with one argument.
That is, if ``my_align_as`` is in the list,
then :code-c:`my_align_as(X)` is parsed as an attribute
for all strings ``X`` that have balanced braces
(:code-c:`()`, :code-c:`[]`, and :code-c:`{}`).
For example, this can be used when :code-c:`#define`
has been used for attributes, for portability.
Example:
.. code-block:: python
c_paren_attributes = [
'my_align_as',
]
.. versionadded:: 3.0
.. versionchanged:: 7.4
:confval:`!c_paren_attributes` can now be a tuple.
.. _cpp-config:
Options for the C++ domain
--------------------------
.. confval:: cpp_id_attributes
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A sequence of strings that the parser should additionally accept
as attributes.
For example, this can be used when :code-cpp:`#define`
has been used for attributes, for portability.
Example:
.. code-block:: python
cpp_id_attributes = [
'my_id_attribute',
]
.. versionadded:: 1.5
.. versionchanged:: 7.4
:confval:`!cpp_id_attributes` can now be a tuple.
.. confval:: cpp_index_common_prefix
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A list of prefixes that will be ignored
when sorting C++ objects in the global index.
Example:
.. code-block:: python
cpp_index_common_prefix = [
'awesome_lib::',
]
.. versionadded:: 1.5
.. confval:: cpp_maximum_signature_line_length
:type: :code-py:`int | None`
:default: :code-py:`None`
If a signature's length in characters exceeds the number set,
each parameter within the signature will be displayed on
an individual logical line.
When :code-py:`None`, there is no maximum length and the entire
signature will be displayed on a single logical line.
This is a domain-specific setting,
overriding :confval:`maximum_signature_line_length`.
.. versionadded:: 7.1
.. confval:: cpp_paren_attributes
:type: :code-py:`Sequence[str]`
:default: :code-py:`()`
A sequence of strings that the parser should additionally accept
as attributes with one argument.
That is, if ``my_align_as`` is in the list,
then :code-cpp:`my_align_as(X)` is parsed as an attribute
for all strings ``X`` that have balanced braces
(:code-cpp:`()`, :code-cpp:`[]`, and :code-cpp:`{}`).
For example, this can be used when :code-cpp:`#define`
has been used for attributes, for portability.
Example:
.. code-block:: python
cpp_paren_attributes = [
'my_align_as',
]
.. versionadded:: 1.5
.. versionchanged:: 7.4
:confval:`!cpp_paren_attributes` can now be a tuple.
Options for the Javascript domain
---------------------------------
.. confval:: javascript_maximum_signature_line_length
:type: :code-py:`int | None`
:default: :code-py:`None`
If a signature's length in characters exceeds the number set,
each parameter within the signature will be displayed on
an individual logical line.
When :code-py:`None`, there is no maximum length and the entire
signature will be displayed on a single logical line.
This is a domain-specific setting,
overriding :confval:`maximum_signature_line_length`.
.. versionadded:: 7.1
.. confval:: javascript_trailing_comma_in_multi_line_signatures
:type: :code-py:`bool`
:default: :code-py:`True`
Use a trailing comma in parameter lists spanning multiple lines, if true.
.. versionadded:: 8.2
Options for the Python domain
-----------------------------
.. confval:: add_module_names
:type: :code-py:`bool`
:default: :code-py:`True`
A boolean that decides whether module names are prepended
to all :term:`object` names
(for object types where a "module" of some kind is defined),
e.g. for :rst:dir:`py:function` directives.
.. confval:: modindex_common_prefix
:type: :code-py:`list[str]`
:default: :code-py:`[]`
A list of prefixes that are ignored for sorting the Python module index
(e.g., if this is set to :code-py:`['foo.']`,
then ``foo.bar`` is shown under ``B``, not ``F``).
This can be handy if you document a project that consists of a
single package.
.. caution::
Works only for the HTML builder currently.
.. versionadded:: 0.6
.. confval:: python_display_short_literal_types
:type: :code-py:`bool`
:default: :code-py:`False`
This value controls how :py:data:`~typing.Literal` types are displayed.
Examples
~~~~~~~~
The examples below use the following :rst:dir:`py:function` directive:
.. code-block:: rst
.. py:function:: serve_food(item: Literal["egg", "spam", "lobster thermidor"]) -> None
When :code-py:`False`, :py:data:`~typing.Literal` types display as per standard
Python syntax, i.e.:
.. code-block:: python
serve_food(item: Literal["egg", "spam", "lobster thermidor"]) -> None
When :code-py:`True`, :py:data:`~typing.Literal` types display with a short,
:PEP:`604`-inspired syntax, i.e.:
.. code-block:: python
serve_food(item: "egg" | "spam" | "lobster thermidor") -> None
.. versionadded:: 6.2
.. confval:: python_maximum_signature_line_length
:type: :code-py:`int | None`
:default: :code-py:`None`
If a signature's length in characters exceeds the number set,
each parameter within the signature will be displayed on
an individual logical line.
When :code-py:`None`, there is no maximum length and the entire
signature will be displayed on a single logical line.
This is a domain-specific setting,
overriding :confval:`maximum_signature_line_length`.
For the Python domain, the signature length depends on whether
the type parameters or the list of arguments are being formatted.
For the former, the signature length ignores the length of the arguments list;
for the latter, the signature length ignores the length of
the type parameters list.
For instance, with :code-py:`python_maximum_signature_line_length = 20`,
only the list of type parameters will be wrapped
while the arguments list will be rendered on a single line
.. code-block:: rst
.. py:function:: add[T: VERY_LONG_SUPER_TYPE, U: VERY_LONG_SUPER_TYPE](a: T, b: U)
.. versionadded:: 7.1
.. confval:: python_trailing_comma_in_multi_line_signatures
:type: :code-py:`bool`
:default: :code-py:`True`
Use a trailing comma in parameter lists spanning multiple lines, if true.
.. versionadded:: 8.2
.. confval:: python_use_unqualified_type_names
:type: :code-py:`bool`
:default: :code-py:`False`
Suppress the module name of the python reference if it can be resolved.
.. versionadded:: 4.0
.. caution::
This feature is experimental.
.. confval:: trim_doctest_flags
:type: :code-py:`bool`
:default: :code-py:`True`
Remove doctest flags (comments looking like :code-py:`# doctest: FLAG, ...`)
at the ends of lines and ``<BLANKLINE>`` markers for all code
blocks showing interactive Python sessions (i.e. doctests).
See the extension :mod:`~sphinx.ext.doctest` for more
possibilities of including doctests.
.. versionadded:: 1.0
.. versionchanged:: 1.1
Now also removes ``<BLANKLINE>``.
Extension options
=================
Extensions frequently have their own configuration options.
Those for Sphinx's first-party extensions are documented
in each :doc:`extension's page </usage/extensions/index>`.
Example configuration file
==========================
.. code-block:: python
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'Test Project'
copyright = '2000-2042, The Test Project Authors'
author = 'The Authors'
version = release = '4.16'
# -- General configuration ------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
]
extensions = []
language = 'en'
master_doc = 'index'
pygments_style = 'sphinx'
source_suffix = '.rst'
templates_path = ['_templates']
# -- Options for HTML output ----------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'alabaster'
html_static_path = ['_static']
|