Comments (8)
I think the current behavior is extremely counter-intuitive. I mean, it just breaks markdown specification on how to visually render the text, as well as most markdown-s I write.
If there would be a vote, I would vote to render text without the explicit URL, and only put the URL in the pop-up (if it was not explicitely specified in the markdown).
from markdown-pdf.
The default CSS inserts links' href
s in parentheses after the link. This part does it.
You can disable that by putting this in your custom CSS:
a[href]:after { content : "" }
Do keep in mind that readers won't otherwise know what that link refers to.
from markdown-pdf.
The current directory is whichever directory you run markdown-pdf from. There's no need to edit the CSS files that come with markdown-pdf, since you can specify your own.
The following is a minimal example that works for me. In an empty directory, create these:
package.json
:
{
"scripts": {
"compile": "markdown-pdf --css-path custom.css test.markdown"
},
"dependencies": {
"markdown-pdf": "^5.3.0"
}
}
test.markdown
:
[this is a link](http://github.com)
custom.css
:
a[href]:after { content : "" }
Running npm install
in that directory should install markdown-pdf.
Running npm run compile
should run markdown-pdf using the custom CSS, producing an output PDF without a parenthesised URL after the link.
from markdown-pdf.
Thanks for the quick reply. I understand now that this is a feature, not a bug.
Nonetheless I am struggling to get the custom css to be noticed. I made the change you suggested to the [module path]/markdown-pdf/css/pdf.css
that comes with the package but no joy. The help says the custom css path is the:
Path to custom CSS file, relative to the current directory.
In this case, can you tell me what is the current directory? The root of the site or somewhere in the module package.
Thanks.
from markdown-pdf.
We have progress :-)
I have managed to get my custom css file picked up by the npm module. Things were somewhat complicated by the fact that I am using Meteor so, just in case any future readers are interested, I got it working by first installing the following package: meteor add ostrio:meteor-root
Then I put my custom_pdf.css
file, containing just the css you specified, in the special folder private
in the root of my site. Meteor will make this file available at: /.meteor/local/build/programs/server/assets/app/custom_pdf.css
.
So now I can get the correct file-path in my code using the following line (coffeescript):
cssPath = "#{Meteor.rootPath}\\assets\\app\\custom_pdf.css"
This generates a pdf with the links rendered as required:
However a new problem has now appeared. The links do not actually work. Hovering over the links does not change the cursor and they are not clickable.
Since we have got this far together I would be really grateful if you could test your version and see if if you have the same problem.
Thanks
from markdown-pdf.
Yey for progress!
As for links not being clickable, unfortunately I get the same: the "links" are just rendered as styled text, with no hyperlink embedded in the PDF (tested with Chromium's PDF plugin and zathura).
In fact, the rest of this problem seems to be exactly issue #30, which is common, judging by comments there and on ariya/phantomjs#10196 (the upstream deficiency causing this for us). #30 is closed for some reason despite being unresolved; I've asked for it to be reopened (@alanshaw?).
I'll look into this some more and post updates at #30 if I find a solution or workaround.
from markdown-pdf.
Thanks for the update and all your help. I will close this issue now and keep an eye on #30.
from markdown-pdf.
Hi,
I have just downloaded markdown-pdf and I still getting the same issue with links. I am afraid that in my case without proper links the generated PDF is useless. Is there any progress on this task?
from markdown-pdf.
Related Issues (20)
- Doesn't work: `internal/validators.js:125` `TypeError [ERR_INVALID_ARG_TYPE]` HOT 6
- Doesn't seem to use system fonts on Big Sur
- break new page HOT 1
- How to get column-count working in css
- highlight.js 9.x is obsolete and leads to warnings when used HOT 2
- resize img works in github/gitlab but not in generated pdf
- Use markdown pdf for svelte files
- [feature] runningsPath alternative by using a function
- [derivative] Article with a step-by-step sample showcasing Markdown-pdf HOT 1
- How to use it in native js HOT 2
- code style and some css problems HOT 1
- Emoji's are not rendered HOT 1
- 自动化部署 build的时候打包不成功 HOT 2
- Markdown base url
- TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received null HOT 8
- Trying to render images
- Links rendered but text also includes URL
- Replace phantomjs for rendering
- The `phantomjs-prebuilt` is deprecated, so it's better another library. HOT 1
- output empty pdf file without error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown-pdf.