markdown-pdf
markdown-pdf copied to clipboard
Literal URLs should be rendered once
Literal URLs in a markdown file will be rendered twice.
http://example.com is rendered as http://example.com (http://example.com)
This seems redundant.
I agree.
This happens because the URL in parentheses is added using CSS to any <a href="something">
.
Implementation idea: Drop the CSS. Instead use remark to parse the markdown into mdast, transform Link nodes into Link nodes (followed by Text nodes with the href-in-parentheses if the title
and url
differ), render the tree to HTML again, render to PDF as usual. Harder, but neater. This could be done by a separate module though.
I builded a workaround. Create a custom CSS file:
@media print {
a[href]:after {
content: "" !important;
}
abbr[title]:after {
content: " " !important;
}
body {
font-size: 0.625em;
}
}
Include this file via options.cssPath in js, or via --css-path in shell.
We just encountered the same issue. In our case an extra CSS file is not really an option here. Any suggestions?
@Zadagu Thanks for the idea!
I've added that:
a[href]:after {
content: "" !important;
}
To my CSS and it helped. I think, issue could be closed as that is just a CSS problem
Thankfully this also fixes [LInk Name](https://link.to.something)