Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Standalone portable viewer, auto-open file with same name #56

Closed
ggppjj opened this issue Oct 14, 2024 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@ggppjj
Copy link

ggppjj commented Oct 14, 2024

Hello!

I like the idea of including documentation as markdown with some of my projects, and it would seem that the best way to do that would be to include a portable markdown viewer to render them.

I haven't found a good solution yet, and was wondering what your thoughts were as to bundling this as a no-install portable app were. In my own head (and I'm 100% willing to admit that this might be weird/bad), the most ideal setup would be for the exe to have the name of the document it's intended to view, and for it to auto-open that document in the same directory if found.

That way, I can distribute:

  • Program.exe
  • readme.md
  • readme.exe

And maintain a single readme.md that also acts as the readme for Github.

Yours was the closest I could find to a project that suits my personal wants here, so I figured it would be worth reaching out to see what your thoughts were as to the viability.

@github-actions github-actions bot added the needs reaction Owner didn't react to this issue yet label Oct 14, 2024
@thmmsn
Copy link

thmmsn commented Oct 14, 2024

Good idea with a portable application! However, using a README.exe, auto open, etc,… can be associated with malware, and users might hesitate to open it. What about using a readme.html file, bundled with some css and linking the markdown-file from the html? Those who can read plain markdown can still do that, and those who prefer formatted text can open it in the browser.

@ggppjj
Copy link
Author

ggppjj commented Oct 14, 2024

My own use-case would primarily be to distribute documentation internally as easily as possible, so the thought to auto-open an md file would only really be tailored for this process so that less technically-minded people at my office don't have to figure out what they're doing.

Perhaps a popup to allow the user to confirm the auto-open before it attempts to read the file? My thoughts along these lines would be to only trigger the automatic opening if both:

  1. The portable mdview executable has been renamed.
  2. There is a matching .md file in the same directory.

Adding a popup that then asks "Display filename?" would, I think, alleviate concerns with that association.

@c3er
Copy link
Owner

c3er commented Oct 15, 2024

Hi, thank you for filing this issue!

This idea is really a little weird, but I could implement this. But I have another idea, which doesn't need any changes to the tool and might even be better: just add a properly named batch file next to the portable distribution (i.e. the extracted ZIP file) with this content:

start /B mdview\mdview %~dpn0.md

Screenshot of file explorer showing suggestion

This way, you can have an arbitrary count of Markdown files without adding a ~170 MB overhead for each.

What do you think about this?

Explanations for the command line:

  • start /B starts something "in the background", i.e. the console window does only flicker after double-clicking the batch file instead of staying open.
  • I decided to put the distribution in its own subfolder, so non-technical people don't get scared-off as fast by seeing DLL files, therefore mdview\mdview.
    • The part before the backslash is that subfolder
    • The part after the backslash is the EXE file. The extension .exe can be omitted.
  • %~dpn0 is a pointer to the batch file:
    • d is the drive
    • p is the folder path
    • n is the batch file without extension. f would include the extension

@c3er c3er added enhancement New feature or request and removed needs reaction Owner didn't react to this issue yet labels Oct 15, 2024
@ggppjj
Copy link
Author

ggppjj commented Oct 15, 2024

Not a bad option, could remove the need for a batch file also with a windows shortcut and added parameter also. I'll consider this approach for now, with, say, a hidden folder for the docs and a hidden folder for the viewer, with a toplevel folder of shortcuts to each doc. Thanks!

I hadn't considered the download size considering Electron with the original thought, though, that is a good point. I can host it internally as described above.

I'll have to think about this a bit further, and the specific weird thing I'm looking to do may end up being better as its own project considering I have goals that aren't particularly typically useful for a more general markdown viewer to aim for. It also might end up just being a bad idea that wasn't fully thought out at the asking, haha.

Thanks for the reply!

@ggppjj ggppjj closed this as completed Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants