aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmcv <smcv@web>2017-05-16 05:38:02 -0400
committeradmin <admin@branchable.com>2017-05-16 05:38:02 -0400
commit6ab4dee7287ee13d21435402234eef3c93f1841e (patch)
treef7c1b380e8f9ea41e195ab78327972a6bf4d62b4
parent81221cb030a27c0b8c22d506540375396437c609 (diff)
downloadikiwiki-6ab4dee7287ee13d21435402234eef3c93f1841e.tar
ikiwiki-6ab4dee7287ee13d21435402234eef3c93f1841e.tar.gz
we should prefer existing IDs and only act as a fallback
-rw-r--r--doc/plugins/contrib/i18nheadinganchors/discussion.mdwn29
1 files changed, 26 insertions, 3 deletions
diff --git a/doc/plugins/contrib/i18nheadinganchors/discussion.mdwn b/doc/plugins/contrib/i18nheadinganchors/discussion.mdwn
index 699f05500..716fc0902 100644
--- a/doc/plugins/contrib/i18nheadinganchors/discussion.mdwn
+++ b/doc/plugins/contrib/i18nheadinganchors/discussion.mdwn
@@ -1,5 +1,5 @@
I would not be comfortable with merging this into headinganchors and enabling it by
-default for two reasons:
+default for two main reasons:
* it adds a new dependency on [[!cpan Text::Unidecode]]
* Text::Unidecode specifically documents its transliteration as not being stable
@@ -36,16 +36,39 @@ So perhaps we could try this Unicode-aware version of what Pandoc documents:
an unused identifier
(Or to provide better uniqueness, we could parse the document looking for any existing
-ID, then generate IDs avoiding collisions with any of them.)
+ID, then append `-1`, `-2` to each generated ID until there is no collision.)
This would give us, for example, `## Visiting 北京` → `id="visiting-北京"`
-(where Text::Unidecode would instead transliterate, resulting in `id="visiting-bei-jing"`).
+(whereas Text::Unidecode would instead transliterate, resulting in
+`id="visiting-bei-jing"`).
To use these IDs in fragments, I would be inclined to rely on browsers
supporting [IRIs](https://tools.ietf.org/html/rfc3987): `<a href="#visiting-北京">`.
--[[smcv]]
+
+----
+
+Documentation says:
+
+> _Also note that all heading attributes are overriden with the ID tag. If this
+> is not desirable, we'd need to fire up a full HTML::Parser or do some more
+> regex magic to preserve the attributes other than id= which we want to keep._
+
+I think this is a bug, particularly if you are using Pandoc's
+[header attributes](http://pandoc.org/MANUAL.html#extension-header_attributes)
+or similar.
+
+I think we should try to use an existing ID before generating our own, with the
+generation step as a fallback, just like Pandoc does. If a htmlize layer like
+Text::MultiMarkdown or Pandoc is generating worse IDs than this plugin, the
+the right solution to that is to send a bug report / feature request to
+make its IDs as good as this plugin's, or turn off ID generation in the
+htmlize layer, or stop using Text::MultiMarkdown.
+
+--[[smcv]]
+
----
<pre>Some long scrollable text