Code Monkey home page Code Monkey logo

Comments (8)

vn971 avatar vn971 commented on May 16, 2024 23

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.

anko avatar anko commented on May 16, 2024 20

The default CSS inserts links' hrefs 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.

anko avatar anko commented on May 16, 2024 1

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.

biofractal avatar biofractal commented on May 16, 2024

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.

biofractal avatar biofractal commented on May 16, 2024

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:

image

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.

anko avatar anko commented on May 16, 2024

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.

biofractal avatar biofractal commented on May 16, 2024

Thanks for the update and all your help. I will close this issue now and keep an eye on #30.

from markdown-pdf.

leon-anavi avatar leon-anavi commented on May 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.