: text/plain; charset=utf-8
Le 2015-07-09 ? 0:30, Alan Hogan cont...@alanhogan.com a ?crit :
Furthermore, auto-gen'd headers *will* break when the text of the header
is changed, which can be done for any number of innocuous reasons when we
would like the link to be preserved. (Cool URIs don?t change, right?)
For that reason, I have always been a fan of the ID specification syntax
that pandoc, PHP Markdown Extra, maruku, kramdown, and a few others support:
## This is a header {#a-header}
which compiles to:
h2 id=a-headerThis is a header/h2
Look at that! Cleaner Markdown *and* cleaner output than inserting your
own a tag. And better, more future-proof section IDs than the
auto-generated variety.
Sadly, I never get to use it, due to the regrettable and totally
predictable fact that so many Markdown converters ignore it.
Not to pick on showdown, but look at its output:
h2 id=thisisaheaderaheaderThis is a header {#a-header}/h2
Yeah, this is sad.
I'll just point out that PHP Markdown Extra does support automatic
generation of headers id as long as you provide it with a proper function
to generate the id from the content of the header. For instance, you can
configure the parser like this:
$parser-header_id_func = function ($text) {
return preg_replace('/[^a-z0-9]/', '-', strtolower($text));
};
I'm not providing this function out of the box for a few reasons: 1. any
specific algorithm to generate the id to is going to make some people
complain about non-compatibility with another implementation, and 2. it's
quite hard to come with something that'll work well with non-english text.
Just try it with accented characters and non-latin scripts and appreciate
the nonsense.
http://johnmacfarlane.net/babelmark2/?normalize=1text=%23+English%0A%0A%23+Fran?ais%0A%0A%23+Espa?ol%0A%0A%23+?e?tina%0A%0A%23+???%0A%0A%23+??%0A%0A%23+??%0A%0A%23+???%E2%80%8E%E2%80%8E%0A%0A%23+???
??
Honestly, I find the {#a-header} approach better.
--
Michel Fortin
michel.for...@michelf.ca
https://michelf.ca
-- next part --
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4939 bytes
Desc: not available
URL:
https://pairlist6.pair.net/pipermail/markdown-discuss/attachments/20150709/3da77f0a/attachment-0001.bin
--
Message: 3
Date: Thu, 9 Jul 2015 11:56:40 -0700
From: Alice Williams awilli...@machinezone.com
To: markdown-discuss@six.pairlist.net
Subject: How to create anchors in Fireball version of Markdown?(gitlab
version links do not work)
Message-ID:
CAFhkAKOBQEfR=
fuwf3yhootkc7_xqvjyaxkqhw+i9bdj6nq...@mail.gmail.com
Content-Type: text/plain; charset=utf-8
Hi all,
Just curious if anyone knows how to get anchor links to work with Fireball
version of Markdown. (The Gitlab standard Markdown achieves anchor links
like this (but Fireball version does not support this format):
[link text](#anchor)
This anchor link does not work with Fireball version.
Does anyone know how to create Fireball Markdown anchors?
Thanks,
Alice
-- next part --
An HTML attachment was scrubbed...
URL:
https://pairlist6.pair.net/pipermail/markdown-discuss/attachments/20150709/b8b044f2/attachment-0001.html
--
Message: 4
Date: Thu, 09 Jul 2015 15:16:32 -0400
From: Fletcher T. Penney fletc...@fletcherpenney.net
To: Discussion related to Markdown.
markdown-discuss@six.pairlist.net
Subject: Re: How to create anchors in Fireball version of
Markdown?(gitlab version links do not work)
Message-ID: 559ec890.4030...@fletcherpenney.net
Content-Type: text/plain; charset=windows-1252; format=flowed
I think you need to be more precise in your question. I tried to flesh
it out in my prior response, but perhaps I failed.
The link you describe:
[link text](#anchor)
works just fine in any version of Markdown. It's just a regular link.
I suspect the problem you are having, as per my other message, is that
you need something for the link to target. If an anchor named
#anchor doesn't exist, that's a separate problem.
The various replies to your earlier message all suggested ways of
creating the necessary anchor that would work.
If those replies did not answer your question, then perhaps you could
more precisely specify the HTML output you are getting and the HTML
output you are expecting.
Fletcher
On 7/9/15 2:56 PM, Alice Williams wrote:
Hi all,
Just curious if anyone knows how to get anchor links to work with
Fireball version of Markdown. (The Gitlab standard Markdown achieves
anchor links like this (but Fireball version does not support this
format):
[link text](#anchor)
This anchor link does not work with Fireball version.
Does anyone know how to create Fireball Markdown anchors