Lister-Plugin for Markdown formatted text documents?
Moderators: white, Hacker, petermad, Stefan2
Re: Lister-Plugin for Markdown formatted text documents?
2rg_software
Works fine under Windows XP with https://www.dropbox.com/s/gyx3rzsp8bryucl/README.md?dl=1
Works fine under Windows XP with https://www.dropbox.com/s/gyx3rzsp8bryucl/README.md?dl=1
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
- rg_software
- Member
- Posts: 113
- Joined: 2009-08-06, 12:59 UTC
- Location: Aizu-Wakamatsu, Japan
Re: Lister-Plugin for Markdown formatted text documents?
Code: Select all
Could you explain it more detaily, please?
What bug do you mean?
What toolset/compiler have you used and what compiler switches have you changed/added?
Code: Select all
/Zc:threadSafeInit-
As of your comments on functionality -- yes, duly noted. I can't promise any quick fixes soon, since most of them actually caused with the fact that there is no html document to be loaded into the HTMLView window, which breaks some functionality, and there is no easy way to fix it.Thread-safe static local variables use thread-local storage (TLS) internally to provide efficient execution when the static has already been initialized. The implementation of this feature relies on Windows operating system support functions in Windows Vista and later operating systems. Windows XP, Windows Server 2003, and older operating systems do not have this support, so they do not get the efficiency advantage. These operating systems also have a lower limit on the number of TLS sections that can be loaded. Exceeding the TLS section limit can cause a crash. If this is a problem in your code, especially in code that must run on older operating systems, use /Zc:threadSafeInit- to disable the thread-safe initialization code.
Let me elaborate. In principle, the Web browser component used by HTMLView is designed to load and display an HTML file specified with a URL. Here I have to convert markdown into HTML in-memory and display the resulting data. In the first version of the plugin I tried to save a temp file on the disk and show it, but this solution has other disadvantages. So I go with in-memory processing.
Loading in-memory data into Web browser is not really supported, but there are quite hacky ways to do it. Regardless of the particular hack, there is no real URL-specified document anymore and thus no base directory, no way to refresh or reload it, and so on (for example, you cannot change character encoding if it was guessed incorrectly).
Basically, the only difference between the current plugin and the original HTMLView is this difference: disk file vs. in-memory string. Otherwise the functionality should be identical. So I get your points, but to be honest I simply cannot estimate how hard is to fix any of them and whether it is possible at all (for instance, I need to override menu actions of the right-click context menu, but I have no idea whather this is can be done).
Re: Lister-Plugin for Markdown formatted text documents?
Thanks a lot for your explanations and for your great work.rg_software wrote: ↑2018-12-27, 20:36 UTC In a nutshell,compiler option is needed.Code: Select all
/Zc:threadSafeInit-
in code that must run on older operating systems, use /Zc:threadSafeInit- to disable the thread-safe initialization code.
I think you should create html file in the directory of the source md file, if possible. That way linking and navigation inside large documents will work OK - to me it's a key feature of markdown format and its support is a must.rg_software wrote: ↑2018-12-27, 20:36 UTC I tried to save a temp file on the disk and show it, but this solution has other disadvantages. So I go with in-memory processing.
And if the directory is read-only, use %temp% dir instead. Current hack for in-memory work is really ugly - Lister shows about:blank in the title as a file name…
And in any case you should disable unavailable buttons.
Well, markdown files by default are in UTF-8, so it's not the case…rg_software wrote: ↑2018-12-27, 20:36 UTC (for example, you cannot change character encoding if it was guessed incorrectly).
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
- rg_software
- Member
- Posts: 113
- Joined: 2009-08-06, 12:59 UTC
- Location: Aizu-Wakamatsu, Japan
Re: Lister-Plugin for Markdown formatted text documents?
I agree that I perhaps should disable the buttons if they don't work, though you can still access the same items from the context menu
As of the temp file -- well, it was my initial approach. One of the problems with it is that if you write a temp file to the temp dir, then base_dir becomes the same as the temp dir, so all relative links to images are immediately broken. Also I got reports that if you quickly switch between the source files, it's really difficult to keep track of which temp files neccessary and which are not.
I mean, I appreciate your comments, but believe me, there are no 100% solutions here. Initially I used a tempfile which is MUCH easier for me, but had to abandon this approach after all.
As of the temp file -- well, it was my initial approach. One of the problems with it is that if you write a temp file to the temp dir, then base_dir becomes the same as the temp dir, so all relative links to images are immediately broken. Also I got reports that if you quickly switch between the source files, it's really difficult to keep track of which temp files neccessary and which are not.
I mean, I appreciate your comments, but believe me, there are no 100% solutions here. Initially I used a tempfile which is MUCH easier for me, but had to abandon this approach after all.
Re: Lister-Plugin for Markdown formatted text documents?
I think you are going wrong way and doing unneeded work. There is a problem only with relative links to other files and only when you cannot write access to the source directory, but you must generate proper HTML code. Other links should always stay unchanged, even for in-memory work.
Short explanation of my requests follows below. It should work OK in almost all cases, use it at will.
Short explanation of my requests follows below. It should work OK in almost all cases, use it at will.
- Make sure you can write to the source directory, otherwise use %TEMP% directory.
If you have filename.md convert it to filename.html if possible. - Make proper conversion from markdown to links:
- For internal links (starting with #) - leave them relative and add proper id to any linked item.
For example: You have [Linked item](#anchor-id). Convert it to <a href="#anchor-id">Linked item</a>, then find line:
# Linked item
or
## Linked item
etc.
and convert it to <h1 id="anchor-id">Linked item<h1>
or <h2 id="anchor-id">Linked item<h2> etc. - Relative links to other files also leave unchanged.
F.e. convert [LICENSE](LICENSE.txt) to <a href="LICENSE.txt">LICENSE</a>
If you cannot write to the source directory, change relative links to other files into absolute links adding the source directory to the link.
F.e. convert [LICENSE](LICENSE.txt) to <a href="file:///C:/TEST/LICENSE.txt">LICENSE</a>.
I'm not sure if IE control used in HTMLView supports file: protocol, maybe you should use <a href="C:/TEST/LICENSE.txt">LICENSE</a> syntax. - Absolute links leave also unchanged.
- For internal links (starting with #) - leave them relative and add proper id to any linked item.
- Add table support, see "Platform Matrix" in the linked Harbour readme.md (no explanation for now).
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
Re: Lister-Plugin for Markdown formatted text documents?
Thanks for the plugin!
I have found a bug though.
Lists are not indented correctly, see for example this text, obtained with VS Code and "create TOC":
The preview shows a single level of indentation, but there should be two of them.
I have found a bug though.
Lists are not indented correctly, see for example this text, obtained with VS Code and "create TOC":
Code: Select all
# Title
- [Title](#title)
- [Section 1](#section-1)
- [Subsection 1.1](#subsection-11)
- [Section 2](#section-2)
## Section 1
### Subsection 1.1
## Section 2
Re: Lister-Plugin for Markdown formatted text documents?
Lister can display formated markdown fine for me if I set the preview to 8 (Explorer preview)
No need for any plugin.
No need for any plugin.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1375a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
TC 11.03 x64 / x86
Everything 1.5.0.1375a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
Re: Lister-Plugin for Markdown formatted text documents?
It should be mentioned, that Horst.Epp's hint for the lister works only if you have installed an Markdown preview for Windows Explorer. One that is working here: Microsoft PowerToys (see Settings > File Explorer Add-ons)
Re: Lister-Plugin for Markdown formatted text documents?
2Gerby Thank you for this hint!
Dateimanagerfetischist.
Re: Lister-Plugin for Markdown formatted text documents?
I've heard that some third-party file managers also use Windows Explorer plug-ins.
Dateimanagerfetischist.