Coder Social home page Coder Social logo

Display non-md files about madness HOT 10 CLOSED

rfparedes avatar rfparedes commented on May 29, 2024
Display non-md files

from madness.

Comments (10)

DannyBen avatar DannyBen commented on May 29, 2024

As I understand your question, it seems like you are talking about two different thing.

If you want PDF and files other than markdown files to appear in the sidebar and search, then no - this is out of scope for madness. It is not a generic file server, but a structured (yet freeform) documentation server.

As for creating links to other files, of course it is possible, in one of two forms at least:

  • Create a link to any other file by using a standard markdown link:
    [link to any file](any-file.txt)
  • Embed images using a standard markdown image:
    ![Image Title for embedded image](image.jpg)
  • In both cases, the asset can be anywhere, but the link should either be absolute or relative to the folder where the markdown file resides.

Another approach that might be suitable for your use case, is to use HTML iframe to embed any content (text file, PDF document) right inside your markdown. Something like this:

<iframe src="any-file.txt" width="100%" frameborder="0" height="300"/></iframe>

Hope this helps.

from madness.

rfparedes avatar rfparedes commented on May 29, 2024

Thanks for the quick response. What I was asking for is what's out of scope. I already have the .md files with links to images or pdfs to continue to work that way. Thanks for the HTML iframe approach also. Much appreciated...

from madness.

DannyBen avatar DannyBen commented on May 29, 2024

By the way - I am not sure it will be THAT difficult to implement it, in a configurable way.
Perhaps something like a configuration to say:

also_show_extensions: pdf png txt

Does your requirement have anything other than what described earlier?
Should these just appear in the sidebar?

from madness.

rfparedes avatar rfparedes commented on May 29, 2024

That would be great. And that would be my only requirement. It would give me the ability to have a single interface (madness) for all my notes without having to create the underlying .md file with the pdf link as you previously described.

from madness.

DannyBen avatar DannyBen commented on May 29, 2024

Well, I have tried it and it is a little weird.

Adding the links to the menu, is easy enough and easily configurable.
The problem is, that when you click any of these links, it just lets the browser handle these files, so by clicking them, you lose the side menu and everything.

In a more thoughtful implementation, I would have expected to:

  1. Have the file be rendered inside the template (for supported file extensions), perhaps like GitHub is allowing file preview.
  2. Have the extension not show in the side menu, and instead show a small "label" with the uppercase extension, or something more elegant than what can be seen in the screencast below.

Anyways - here is a demo screencast, showing pdf and txt link examples.
screencast

In your view, is this acceptable as is, or must we render the files inside the usual template?

from madness.

rfparedes avatar rfparedes commented on May 29, 2024

That's 100% what I was expecting. It's totally acceptable. Would be great.

from madness.

DannyBen avatar DannyBen commented on May 29, 2024

Alrighty then. I will organize the code a little, add docs and specs and prepare a version, hopefully you will have time to test it before I release. Will report back here when ready.

from madness.

DannyBen avatar DannyBen commented on May 29, 2024

Hi,

A version is ready if you wish to test it before I pack a new gem release.

To do so, you will need to:

  1. Add this Gemfile in your madness documentation folder:
# Gemfile
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem "madness", github: 'DannyBen/madness', branch: 'add/expose-extensions'
  1. run bundle

  2. Add this to your .madness.yml config file

expose_extensions: pdf,txt
  1. run madness with bundle exec madness

from madness.

rfparedes avatar rfparedes commented on May 29, 2024

Yup, works like a charm and exactly what I was looking for. This is great. I appreciate this a lot.

from madness.

DannyBen avatar DannyBen commented on May 29, 2024

Version 0.9.3 is released to Rubygems, and if you are using the docker version, it is being built right now.

Thanks for your suggestion and feel free to comment here (or open a new issue) if you encounter any problems.

from madness.

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.