cortav  Diff

Differences From Artifact [19e0c83304]:

To Artifact [cf364bf145]:


   209    209   		fortran = { color = 0xff779a };
   210    210   		python = { color = 0xffd277 };
   211    211   		python = { color = 0xcdd6ff };
   212    212   	}
   213    213   
   214    214   	local stylesets = {
   215    215   		header = [[
   216         -			h1 { font-size: 200%; border-bottom-style: double !important; border-bottom-width: 3px !important; }
   217         -			h2 { font-size: 130%; }
   218         -			h3 { font-size: 110%; }
   219         -			h4 { font-size: 100%; font-weight: normal; }
          216  +			h1,h2,h3,h4,h5,h6 { border-bottom: 1px solid @tone(0.7); }
          217  +			h1 { font-size: 200%; border-bottom-style: double !important; border-bottom-width: 3px !important; margin: 0em -1em; }
          218  +			h2 { font-size: 130%; margin: 0em -0.7em; }
          219  +			h3 { font-size: 110%; margin: 0em -0.5em; }
          220  +			h4 { font-size: 100%; font-weight: normal; margin: 0em -0.2em; }
   220    221   			h5 { font-size: 90%; font-weight: normal; }
   221    222   			h6 { font-size: 80%; font-weight: normal; }
   222    223   			h3, h4, h5, h6 { border-bottom-style: dotted !important; }
          224  +			h1,h2,h3,h4,h5,h6 { 
          225  +				margin-top: 0;
          226  +				margin-bottom: 0;
          227  +			}
          228  +			:is(h1,h2,h3,h4,h5,h6) + p {
          229  +				margin-top: 0.4em;
          230  +			}
          231  +
          232  +		]];
          233  +		headingAnchors = [[
          234  +			:is(h1,h2,h3,h4,h5,h6) > a[href].anchor {
          235  +				text-decoration: none;
          236  +				font-size: 1.2em;
          237  +				padding: 0.3em;
          238  +				opacity: 0%;
          239  +				transition: 0.3s;
          240  +				font-weight: 100;
          241  +			}
          242  +			:is(h1,h2,h3,h4,h5,h6):hover > a[href].anchor {
          243  +				opacity: 50%;
          244  +			}
          245  +			:is(h1,h2,h3,h4,h5,h6) > a[href].anchor:hover {
          246  +				opacity: 100%;
          247  +			}
          248  +
          249  +			]] .. -- this is necessary to avoid the sections jumping around
          250  +			      -- when focus changes from one to another
          251  +			[[ section {
          252  +				border: 1px solid transparent;
          253  +			}
          254  +
          255  +			section:target {
          256  +				margin-left: -2em;
          257  +				margin-right: -2em;
          258  +				padding: 0 2em;
          259  +				background: @tone(0.04);
          260  +				border: 1px dotted @tone(0.3);
          261  +			}
          262  +
          263  +			section:target > :is(h1,h2,h3,h4,h5,h6) {
          264  +
          265  +			}
          266  +		]];
          267  +		paragraph = [[
          268  +			p {
          269  +				margin: 0.7em 0;
          270  +			}
          271  +			section {
          272  +				margin: 1.2em 0;
          273  +			}
          274  +			section:first-child { margin-top: 0; }
   223    275   		]];
   224    276   		accent = [[
   225    277   			body { background: @bg; color: @fg }
   226    278   			a[href] {
   227    279   				color: @tone(0.7 30);
   228    280   				text-decoration-color: @tone/0.4(0.7 30);
   229    281   			}
   230    282   			a[href]:hover {
   231    283   				color: @tone(0.9 30);
   232    284   				text-decoration-color: @tone/0.7(0.7 30);
   233    285   			}
   234         -			h1,h2,h3,h4,h5,h6 { border-bottom: 1px solid @tone(0.7); }
   235    286   			h1 { color: @tone(2); }
   236    287   			h2 { color: @tone(1.5); }
   237    288   			h3 { color: @tone(1.2); }
   238    289   			h4 { color: @tone(1); }
   239    290   			h5,h6 { color: @tone(0.8); }
   240    291   		]];
   241    292   		code = [[
................................................................................
   442    493   				end
   443    494   			end
   444    495   			return lst
   445    496   		end
   446    497   
   447    498   		local block_renderers = {
   448    499   			paragraph = function(b,s)
          500  +				stylesNeeded.paragraph = true;
   449    501   				return tag('p', nil, sr.htmlSpan(b.spans, b, s), b)
   450    502   			end;
   451    503   			directive = function(b,s)
   452    504   				-- deal with renderer directives
   453    505   				local _, cmd, args = b.words(2)
   454    506   				if cmd == 'page-title' then
   455    507   					if not opts.title then doctitle = args end
................................................................................
   544    596   		local irs
   545    597   		if sec.kind == 'ordinary' then
   546    598   			if #(sec.blocks) > 0 then
   547    599   				irs = {tag='section',attrs={id = getSafeID(sec)},nodes={}}
   548    600   
   549    601   				for i, block in ipairs(sec.blocks) do
   550    602   					local rd = irBlockRdrs[block.kind](block,sec)
   551         -					if rd then table.insert(irs.nodes, rd) end
          603  +					if rd then
          604  +						if opts['heading-anchors'] and block == sec.heading_node then
          605  +							stylesNeeded.headingAnchors = true
          606  +							table.insert(rd.nodes, ' ')
          607  +							table.insert(rd.nodes, {
          608  +								tag = 'a';
          609  +								attrs = {href = '#' .. irs.attrs.id, class='anchor'};
          610  +								nodes = {type(opts['heading-anchors'])=='string' and opts['heading-anchors'] or '§'};
          611  +							})
          612  +						end
          613  +						table.insert(irs.nodes, rd)
          614  +					end
   552    615   				end
   553    616   			end
   554    617   		elseif sec.kind == 'blockquote' then
   555    618   		elseif sec.kind == 'listing' then
   556    619   		elseif sec.kind == 'embed' then
   557    620   		end
   558    621   		if irs then table.insert(ir, irs) end