Discussion:
[hakyll] Syntax highlighting creating anchor tags?
m***@robertwpearce.com
2018-10-02 02:43:15 UTC
Permalink
I opened a GitHub issue (https://github.com/jaspervdj/hakyll/issues/662)
but am unsure how actively maintained it is over there so thought I'd try
here.

Hi! Thanks for making this project. I'm new to Hakyll and have converted
my blog/website over, but there's one thing preventing me from publishing:
syntax highlighting for a given language seems to use anchor tags within
the code block, itself. Simple steps to reproduce:

1. `$ hakyll-init the-site`
1. `$ cd the-site`
1. `$ stack init`
1. `$ stack build`
1. `$ stack exec site build`
1. `$ vim posts/2015-08-12-spqr.markdown`
1. add the following to the post content:
```
```
const abc = 123
```
```
1. `$ stack exec site watch`
1. `$ open http://localhost:8000/posts/2015-12-07-tu-quoque.html`
1. view the HTML for the code block:
```html
<div class="sourceCode" id="cb1">
<pre class="sourceCode js">
<code class="sourceCode javascript">
<a class="sourceLine" id="cb1-1" data-line-number="1">
<span class="kw">const</span> abc <span class="op">=</span> <span
class="dv">123</span>
</a>
</code>
</pre>
</div>
```

As you can see, an `<a>` tag is created, which doesn't seem like that
should be there? Is that just how pandoc works or something? Wonder what
I'm missing...

Any help would be much appreciated!
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jasper Van der Jeugt
2018-10-02 15:04:03 UTC
Permalink
Hi,

Yes, it seems like this is the default for Pandoc now:

$ pandoc --version
pandoc 2.1.2

$ echo -ne '```haskell\nputStrLn "Hello, world"\n```\n' | pandoc
<div class="sourceCode" id="cb1">
<pre class="sourceCode haskell">
<code class="sourceCode haskell">
<a class="sourceLine" id="cb1-1" data-line-number="1">
putStrLn <span class="st">&quot;Hello, world&quot;</span>
</a>
</code>
</pre>
</div>

I suspect the goal of this is to be able to link to specific lines in a
codeblock. For example, I can private message someone a link to

http://example.com/blog/foo#cb1-1

Is this messing up the default CSS? In that case, I can update that.

Hope this helps
Jasper
Post by m***@robertwpearce.com
I opened a GitHub issue (https://github.com/jaspervdj/hakyll/issues/662)
but am unsure how actively maintained it is over there so thought I'd try
here.
Hi! Thanks for making this project. I'm new to Hakyll and have converted
syntax highlighting for a given language seems to use anchor tags within
1. `$ hakyll-init the-site`
1. `$ cd the-site`
1. `$ stack init`
1. `$ stack build`
1. `$ stack exec site build`
1. `$ vim posts/2015-08-12-spqr.markdown`
```
```
const abc = 123
```
```
1. `$ stack exec site watch`
1. `$ open http://localhost:8000/posts/2015-12-07-tu-quoque.html`
```html
<div class="sourceCode" id="cb1">
<pre class="sourceCode js">
<code class="sourceCode javascript">
<a class="sourceLine" id="cb1-1" data-line-number="1">
<span class="kw">const</span> abc <span class="op">=</span> <span
class="dv">123</span>
</a>
</code>
</pre>
</div>
```
As you can see, an `<a>` tag is created, which doesn't seem like that
should be there? Is that just how pandoc works or something? Wonder what
I'm missing...
Any help would be much appreciated!
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Robert Pearce
2018-10-02 17:14:04 UTC
Permalink
Thanks for getting back to me so quickly. It does *not* mess up the default CSS — only on my own things, which is my problem.

Thank you, and I’ll close the issue ASAP on GitHub.
--
Robert Pearce
https://robertwpearce.com
https://www.linkedin.com/in/robertwpearce
m-NZ: +64 20 41305113
m-US: +1 843 568 9080
m-UK: +44 7477 424374
Post by Jasper Van der Jeugt
Hi,
$ pandoc --version
pandoc 2.1.2
$ echo -ne '```haskell\nputStrLn "Hello, world"\n```\n' | pandoc
<div class="sourceCode" id="cb1">
<pre class="sourceCode haskell">
<code class="sourceCode haskell">
<a class="sourceLine" id="cb1-1" data-line-number="1">
putStrLn <span class="st">&quot;Hello, world&quot;</span>
</a>
</code>
</pre>
</div>
I suspect the goal of this is to be able to link to specific lines in a
codeblock. For example, I can private message someone a link to
http://example.com/blog/foo#cb1-1
Is this messing up the default CSS? In that case, I can update that.
Hope this helps
Jasper
Post by m***@robertwpearce.com
I opened a GitHub issue (https://github.com/jaspervdj/hakyll/issues/662)
but am unsure how actively maintained it is over there so thought I'd try
here.
Hi! Thanks for making this project. I'm new to Hakyll and have converted
syntax highlighting for a given language seems to use anchor tags within
1. `$ hakyll-init the-site`
1. `$ cd the-site`
1. `$ stack init`
1. `$ stack build`
1. `$ stack exec site build`
1. `$ vim posts/2015-08-12-spqr.markdown`
```
```
const abc = 123
```
```
1. `$ stack exec site watch`
1. `$ open http://localhost:8000/posts/2015-12-07-tu-quoque.html`
```html
<div class="sourceCode" id="cb1">
<pre class="sourceCode js">
<code class="sourceCode javascript">
<a class="sourceLine" id="cb1-1" data-line-number="1">
<span class="kw">const</span> abc <span class="op">=</span> <span
class="dv">123</span>
</a>
</code>
</pre>
</div>
```
As you can see, an `<a>` tag is created, which doesn't seem like that
should be there? Is that just how pandoc works or something? Wonder what
I'm missing...
Any help would be much appreciated!
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "hakyll" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hakyll/OIQHGUyuVIQ/unsubscribe.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...