tag:support.markedapp.com,2011-09-11:/discussions/problems/135506-bug-report-styling-with-colon-in-header-id-attributeMarked: Discussion 2017-02-17T01:57:19Ztag:support.markedapp.com,2011-09-11:Comment/419662572017-02-16T01:59:24Z2017-02-16T01:59:26ZBug Report: styling with colon in header id attribute<div><p>Let's try the markdown/html portions of that again:</p>
<p>markdown: # My Book: The Awesome Chapter<br>
html: < h1 id="mybook:theawesomechapter>...</p></div>daniel.lawrence.1tag:support.markedapp.com,2011-09-11:Comment/419662572017-02-16T20:08:49Z2017-02-16T20:08:49ZBug Report: styling with colon in header id attribute<div><p><strong><em>Short answer</em></strong>: at the present moment
you'd want to create a selector that encompasses two
possibilities:</p>
<pre>
<code> #mybook:theawesomechapter, #mybooktheawesomechapter {
/* [rules] */
}</code>
</pre>
<p><strong><em>Explanation:</em></strong> this is something I'd be
willing to adjust, but within the Marked preview it <em>does</em>
replace the non-alphanumeric characters in ids (as neither the MMD
or GFM processors do). If you right click the headline in the
preview and inspect, you'll see that it's actually
"mybooktheawesomechapter" in the DOM. However, when it exports, it
leaves the id generated by the markdown processor untouched.</p>
<p>In order for Marked to generate TOC, chapter folding, and other
DOM-based features, it has to have consistent (and valid) id
schemes. But I didn't want to force that onto exported HTML,
especially since it adds ids to elements that don't have them and I
didn't want to output muddied markup.</p>
<p>I could, however, just adjust the way that the multimarkdown and
GFM processors handle it at the core, but it's also a highly
unusual circumstance that a user would want to style a document
based on a specific id rather than just styling h1s universally, so
it hasn't been an issue I've needed to address thus far.</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/419662572017-02-17T00:41:45Z2017-02-17T00:41:45ZBug Report: styling with colon in header id attribute<div><p>The specific circumstance is a book produced upstream used h1s
for both book title and chapter title at the start of each markdown
file. I wished to hide the book title, but keep the chapter titles.
I got around it by using other software to do the final processing
of the HTML Marked produced -- but it would have been nice to work
directly from Marked. The short answer should solve this. The
missing info being the different between DOM vs. Output.</p>
<p>Thanks!</p></div>daniel.lawrence.1tag:support.markedapp.com,2011-09-11:Comment/419662572017-02-17T01:57:18Z2017-02-17T01:57:18ZBug Report: styling with colon in header id attribute<div><p>This could also be accomplished with a pseudo selector like
'h1:first'.</p>
<p>Thanks,<br>
Brett</p></div>Brett