pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.08k stars 131 forks source link

asciidoc-preview in pulsar-editor opens blank window with no text rendered, same occurs in latest atom 1.63 (Markdown IS rendered in pulsar v1.100) #256

Open ianwillie opened 1 year ago

ianwillie commented 1 year ago

Thanks in advance for your bug report!

What happened?

While editing an asciidoc text file in pulsar v1.63, window opens but text does not render. See screenshots attached. I have found that the same bug occurs in the latest flatpak version of atom but works fine in the previous release. These releases are listed below. This was tested with the file test.html.adoc . (However, I cannot attach it because adoc files are not supported by github apparently so remove the terminal ".txt".) So it seems that some change has occurred in both pulsar 1.63 and atom 1.63 which prevents asciidoc-preview rendering text. I use asciidoc a lot for websites because the syntax is concise and quick to type for textual work.

asciidoc-preview renders correctly in this flatpak version of atom: sudo flatpak update --commit=cea629ca495e72d577eae4e64bff902ead937564bc67be7fd6d584554be3de36 io.atom.Atom Atom 1.60.0 x64 from spash screen. Electron 9.4.4, Chrome 83.0.4103.122, Node v12.14.1 Release notes from github 1.60.0 atom-build released this (2022) Mar 8 v1.60.0 03c9ad9

asciidoc-preview opens a blank window with no rendering in this version of atom: Commit: 04c0909c66741eaedd959d013f18df74f6244ba9455914f85511e26601d23e01 Parent: cea629ca495e72d577eae4e64bff902ead937564bc67be7fd6d584554be3de36 Subject: Change xprop archieve (d351a5c4) Date: 2022-12-21 20:31:23 +0000 Atom splash screen: 1.63.1 x64 Electron 11.5.0, Chrome 87.0.4280.141, Node v12.18.3 Release notes from github 1.63.1 released this (2022) Nov 23 v1.63.1 539d250

TEST.html.adoc.txt

Which OS does this happen on?

🐧 Arch based (Manjaro, Garuda, etc.)

OS details

Manjaro latest versions

Which CPU architecture are you running this on?

64-bit(x86_64)

What steps are needed to reproduce this?

Open pulsar. Open file test.html.adoc (attached but remove terminal ".txt" containing these 5 lines: ` = TEST asciidoc rendering

Test asciidoc rendering.

`

Install asciidoc-preview Open above file. With cursor in file press Ctrl+Shift+A Window opens but text does not render.

Repeat the procedure with the two different flatpak versions of atom listed above to see the same bug appear in the l.63 version detailed above.

Additional Information:

Screenshot: Pulsar 1.63 showing no asciidoc-preview rendering of text Pulsar1_63NoRendering

Screenshot: Atom 1.63 showing no asciidoc-preview rendering of text Atom1_63NoRendering

Screenshot: Atom 1.60 showing full asciidoc-preview rendering of text Atom1_60CorrectRendering

confused-Techie commented 1 year ago

Appreciate the contribution!

With this, especially since it's failing on the most recent version of Atom, is likely an issue stemming from bumping node versions, with that said the most helpful thing may be to add the logs from the dev pane if you could, that should tell us what's failing.

But I do want to note, that because this is a community package there may be limited things we can do, but hopefully still we can find a fix, even if it has to occur on a forked version of asciidoc-preview

ianwillie commented 1 year ago

Hi confused-Techie. Thanks for quick response. I am struggling with getting the dev pane operational in flatpak atom or native pulsar running in manjaro. I can get the dev pane to work fine in Ubuntu atom v1.60 (in which asciidoc-review works ) but cannot update this to v1.63 to access the logs with failing asciidoc-preview. When I succeed I will get back to you on this issue: I am not ignoring it. There will be elements that ubuntu install automatically, I guess. I am a new convert to manjaro so until I get more familiar I am a "very-confused-techie", to coin a phrase!

confused-Techie commented 1 year ago

The dev pane not opening (in some linux builds) is a known issue, that should be fixed in our most recent Alpha Binary, otherwise you could try the fix manually by starting Pulsar with --no-sandbox as a launch flag. It may be that Manjaro is just a bit more up to date on some libraries installed.

ianwillie commented 1 year ago

"pulsar --no-sandbox" did the trick. Many thanks. (Also gets dev tools working in "flatpak run io.atom.Atom --no-sandbox" with Ctl-Shft-I. Also in AppImage of pulsar too.) Here is the output from the console. See my note at the end of this. There was no additional output as I opened and closed the asciidoc-preview pane with Ctl-Shft-A. The panel opened & closed but there was no rendering of text. I could not get --log-file to work.

pulsar --no-sandbox --version Pulsar : 1.63.2022112808 Electron: 12.2.3 Chrome : 89.0.4389.128 Node : 14.16.0

############################################ electron/js2c/renderer_init.js:13 (electron) The remote module is deprecated. Use https://github.com/electron/remote instead. log @ electron/js2c/renderer_init.js:13 electron/js2c/renderer_init.js:33 The vm module of Node.js is deprecated in the renderer process and will be removed. o._load @ electron/js2c/renderer_init.js:33 /opt/Pulsar/resources/app.asar/node_modules/scheduler/cjs/scheduler.development.js:348 [Deprecation] SharedArrayBuffer will require cross-origin isolation as of M91, around May 2021. See https://developer.chrome.com/blog/enabling-shared-array-buffer/ for more details. (anonymous) @ /opt/Pulsar/resources/app.asar/node_modules/scheduler/cjs/scheduler.development.js:348 /opt/Pulsar/resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:27773 Download the React DevTools for a better development experience: https://fb.me/react-devtoolsYou might need to use a local HTTP server (instead of file://): https://fb.me/react-devtools-faq /opt/Pulsar/resources/app.asar/src/styles-element.js:107 [Deprecation] ::-webkit-details-marker pseudo element selector is deprecated. Please use ::marker instead. See https://chromestatus.com/feature/6730096436051968 for more details. styleElementAdded @ /opt/Pulsar/resources/app.asar/src/styles-element.js:107 /opt/Pulsar/resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:12357 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

Please update the following components: Command printWarning @ /opt/Pulsar/resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:12357 electron/js2c/renderer_init.js:109 Uncaught (in promise) Error: ERR_FILE_NOT_FOUND (-6) loading 'file:///opt/Pulsar/resources/app.asar.unpacked/node_modules/github/lib/renderer.html?js=%2Fopt%2FPulsar%2Fresources%2Fapp.asar.unpacked%2Fnode_modules%2Fgithub%2Flib%2Fworker.js&managerWebContentsId=1&operationCountLimit=10&channelName=github%3Arenderer-ipc' at rejectAndCleanup (electron/js2c/browser_init.js:217:1457) at Object.failListener (electron/js2c/browser_init.js:217:1670) at Object.emit (events.js:315:20)

DevTools failed to load SourceMap: Could not parse content for file:///tmp/.mount_Linux.WhM1LM/resources/app.asar/node_modules/spelling-manager/lib/BufferSpellingChecker.js.map: Unexpected end of JSON input DevTools failed to load SourceMap: Could not parse content for file:///tmp/.mount_Linux.WhM1LM/resources/app.asar/node_modules/spelling-manager/lib/index.js.map: Unexpected end of JSON input DevTools failed to load SourceMap: Could not parse content for file:///tmp/.mount_Linux.WhM1LM/resources/app.asar/node_modules/spelling-manager/lib/regex-helper.js.map: Unexpected end of JSON input DevTools failed to load SourceMap: Could not parse content for file:///tmp/.mount_Linux.WhM1LM/resources/app.asar/node_modules/spelling-manager/lib/SpellingManager.js.map: Unexpected end of JSON input DevTools failed to load SourceMap: Could not parse content for file:///tmp/.mount_Linux.WhM1LM/resources/app.asar/node_modules/spelling-manager/lib/TokenCheckStatus.js.map: Unexpected end of JSON input DevTools failed to load SourceMap: Could not parse content for file:///tmp/.mount_Linux.WhM1LM/resources/app.asar/node_modules/spelling-manager/lib/TokenSpellingManager.js.map: Unexpected end of JSON input

Now Ctr-Sft-A pressed a few times. The asciidoc-preview window opened and closed as expected but there was no rendering of text. Nothing was added to the console output during this process.

ianwillie commented 1 year ago

Hi confused-Techie A couple of weeks ago you wrote:

With this, especially since it's failing on the most recent version of Atom, is likely an issue stemming from bumping node versions, with that said the most helpful thing may be to add the logs from the dev pane if you could, that should tell us what's failing.

But I do want to note, that because this is a community package there may be limited things we can do, but hopefully still we can find a fix, even if it has to occur on a forked version of asciidoc-preview

I wonder if you would expand on your comment that the problem with asciidoc-preview not rendering text may related to bumping node versions. I have a history of fixing bugs that have appeared when MS or others abandon software having a bit of experience of programming in the past.

I have had a look at some of the code for asciidoc-preview but I have no experience of working with node.js or java as I generally use R, Python, PHP, html, slim, Ruby, Sass, erb etc

I am intrigued by your comment as being a clue to where I might start looking for the problem. So any pointers that you can give me would be much appreciated.

Thanks for your help with this,

I should add that I have had found no other problems using pulsar with any of these: /opt/Pulsar/pulsar --package list --installed --bare Built-in Atom Packages (92) ... Community Packages (16) ~/.pulsar/packages asciidoc-assistant@0.2.3 asciidoc-image-helper@1.0.1 (asciidoc-preview@2.13.1 - my problem package) atom-console@0.4.6 atom-html-preview@0.2.7 atom-space-pen-views@2.2.0 autocomplete-asciidoc@0.1.2 console-panel@0.3.1 contrast-syntax@0.8.1 contrast-ui@0.53.0 file-icons@2.1.47 html2slim@0.5.0 language-asciidoc@1.11.0 language-slim@1.0.1 markdown-preview-plus@4.11.3 script@3.32.2

sertonix commented 1 year ago

I think the problem is that atom-space-pen-views was removed. It is used by asciidoc-.

Edit: I was wrong. That was used correctly.

ianwillie commented 1 year ago

Just an update and a thank you to pulsar developers. I have built a local copy of pulsar and learning to explore problems with packages so as to try and work out problems with asciidoc-preview. Of course, this will take time.

The process has been made much easier than I expected; using the "Hacking the Core" the build and first investigations went faultlessly. So thanks for that and other assistance. https://pulsar-edit.dev/docs/launch-manual/sections/core-hacking/#check-your-build-tools

confused-Techie commented 1 year ago

Just an update and a thank you to pulsar developers. I have built a local copy of pulsar and learning to explore problems with packages so as to try and work out problems with asciidoc-preview. Of course, this will take time.

The process has been made much easier than I expected; using the "Hacking the Core" the build and first investigations went faultlessly. So thanks for that and other assistance. https://pulsar-edit.dev/docs/launch-manual/sections/core-hacking/#check-your-build-tools

Please always feel free to ask about any issues building or troubleshooting, we'd be more than happy to help. But glad to hear you're looking into this issues as well, thanks a ton for helping out!

ianwillie commented 1 year ago

I have just realised that pulsar 1.100.2023011006 (& 1.100.2022122619) do not render Markdown (.md) files in just the same way as is described above for Asciidoc .adoc files. A blank Markdown preview window showing the filenmame at the top appears and the console shows no additional output. "flatpak run io.atom.Atom" runs Atom v1.60 which does render .md & asciidoc files correctly in the preview.. These Pulsar and Atom versions all render .html previews as expected.

Atom_1.63.1 Renders Markdown .md OK Atom_1 63 1_MDRendersOK_Screenshot_2023-01-21_18-56-41

Atom_1.63.1 Fails to render AsciiDoc (v1.60.0 Renders AsciiDoc OK) Atom1_63 1NotRenderingAsciidoc

EDIT Correction: Pulsar 1.100.2023011006 Does render MD with markdown-preview. markdown-preview-plus does not appear to render and also disables markdown-preview. Pulsar1_101_2023012406RenderingMD_Screenshot_2023-01-20_15-37-48

Pulsar 1.100.2023011006 Fails to render Asciidoc Pulsar1_100_2023011006NotRendering_Asciidoc_Screenshot_2023-01-21_15-37-48

Pulsar 1.100.2023011006 Renders HTML OK Pulsar1_100_2023011006RenderingHTML_Screenshot_2023-01-20_15-37-48

ianwillie commented 1 year ago

EDIT Correction. In Pulsar 1.101.2023012406 x64 markdown files .md ARE rendered correctly with markdown-preview 0.160.2. The confusion to the contrary came about because markdown-preview-plus 4.11.3 does not appear to render .md files leaving a window with the correct name but blank contents. However, when markdown-preview-plus is enabled it also disables markdown-preview. It is markdown-preview-plus that is not showing a preview. When markdown-preview is re-enabled the preview appears with Ctrl-Shft-M. The preview is also closed (toggled) with the same keys. (In markdown-preview the .md window does not appear to be synchronised with the preview window. )

For clarity, asciidoc-preview still does not render but opens a window with a title and blank contents. Just as it is described above.

confused-Techie commented 1 year ago

This is some amazing investigation. But due to the failure occurring in the last version of Atom as well, then we can know it's tied to the Electron bump we have both done. So we would have to see exactly what these packages rely on that's changed

ianwillie commented 1 year ago

This is all something of a steep learning curve for me. I am working through Hacking the Core & learning about how packages are constructed. I have had a look at ascidoc-preview package and trying to see what would have changed in the environment around the package because the package itself has not changed. I have a set up a dev package for it and I am about to insert debug messages to indicate what is working. Since there are no error messages that I can see and the tests seem to run OK, I surmise that it must be something pretty near the end. Tracking down the html that is used to generate the final output is my goal at the moment. However, I am so new to node.js, never seen coffee in which ascii-preview is largely written it is all a bit hit & miss at the moment. But, I am learning slowly with the help of others paticularly an informed, even if confused Techie! Thank-you.

Getting asciidoc-preview will eventually be worked out I a sure because the various editors that have such a preview all seem to use the same application, Asciidoctor.js, to do the job. https://docs.asciidoctor.org/asciidoctor/latest/

ianwillie commented 1 year ago

I could do with some help now using pulsar & atom in dev mode to debug the asciidoc-preview package so that I can inspect various variables as the process takes place.

QUESTION: What I want to do is to run the pulsar...appimage --dev no--sandbox with a copy of the supplied asciidoc-preview in .../dev/packages/ians_asciidoc-preview which will be used to insert debug messages. How do I invoke pulsar so that it uses ians_asciidoc-preview. I don't seem to be able to do that using the supplied appimage. I have a memory that I could do that using my locally built pulsar but my intention is to use the supplied pulsar & atom images to see exactly what is happening with them when they fail or succeed to produce a preview or html version of the test.adoc file. I will compare it with what happens with atom 1.60 which does produce a preview, an html and a pdf version of the test.adoc file

My preliminary conclusion looking at all the coffeescript files in lib and transcoding them to javascript, with which I am more familiar, is that the path, filename or extension is not being obtained correctly. A conclusion drawn from the observations that the asciidoc-preview pane is headed "Asciidoc Preview" when "test.adoc preview" with the filename is expected. Similarly the html output obtained on R-click menu on the asciidoc-preview pane is headed "untitled.adoc.html" This html file when saved contains a ... section which appears OK with lots of styles and so on but with a ../ syntactically correct but empty where the output from the .adoc file should be. It seems that the filename cannot be identified for some reason.

Writing this I have just noticed that with atom 1.60 the html version of the asciidoc-preview is correctly saved in "/media/Data/Docs/middleman_sites/ManjTEST01Private/source/_TestOnly/test.adoc.html" where the failing pulsar is trying to save in "/media/Data/Docs/middleman_sites/ManjTEST01Private/untitled.adoc.html". It is trying to save in the root of the Middleman CMS instead of the correct subdirectory. So it looks as though the path is not being correctly picked by one of the asciidoc-preview coffeescript files, like .../lib/main.coffee: time will tell. That could be due to some change in Eclipse, node.js or Chrome not being allowed for in asciidoc-preview: I surmise?

By debugging the coffeescript (or .js files if I can make them work OK) I hope to tract down the origin of the error. Then look farther for the source of the problem

An interesting note is how in writing this description and checking all the details as I go I found the last bit of evidence about the different eroneous path which would have gone unnoticed without this detailed effort. We live & learn.

EDIT: I forgot to add that I have been using Mike Dane's Giraffe Academy website to crash learn Javascript - https://youtu.be/TLlGhogq56Y Some of the best learning resources where I have learnt Middleman CMS, Python, CSS, Ruby and several other.

confused-Techie commented 1 year ago

@ianwillie So try and answer the questions I can:

ianwillie commented 1 year ago

Thanks for that simple and elegant solution to managing packages. Much easier than using dev subdirectory. I have got my own versions of atom-asciidoc-preview up and running. I will report the results in due course.

One point of note is that if we are using a flatpak of atom then the changes which you suggest, or links to them. seem to have to go into the Flatpak systemwide /var/lib/flatpak, or per-user $HOME/.local/share/flatpak. Maybe the same applies to appimages.

EDIT: Here is the answer: on running "flatpak run io.atom.Atom" at the top of the Settings, Install Packages screen it says "Packages are published to atom.io and are installed to ~/.var/app/io.atom.Atom/data/packages" and indeed they are: $ ~/.var/app/io.atom.Atom/data/packages$ ls asciidoc-assistant atom-material-contrast-syntax html2slim preview-plus

$ ~/Downloads/Pulsar-1.101.2023012406.AppImage Settings, Install Packages says: "Packages are published to web.pulsar-edit.dev and are installed to ~/.pulsar/packages".

(I don't know where to get an Appimage of atom to test that. https://apprepo.de/appimage/atom does not seem to load.)

confused-Techie commented 1 year ago

That's an interesting point, and sorry to say I don't have the answer there. Something like that might be a good idea to ping @Linux on our Discord server to find out more. But at the very least glad to hear this can help you test!

ianwillie commented 1 year ago

Update: We seem to be on the right track because various console.log(filename) additions are finding filenames matching the source filename.adoc in atom v1.60.0 asciidoc-preview/lib/main.coffee & asciidoc-preview-view.coffee. However, in pulsar, & atom 1.61 or later not one of these that I have found is correct; these are undefined or very strange. The strangeness is that the form is like "asciidoc-preview://editor/7". Also after keystroke Ctrl-Shft-A which should produce the asciidoc-preview sometimes a new file like "asciidoc-preview://editor/xx" is appearing where xx is a number like 26, 34. They seem to be a files in .../editor which resolutely refuse to be deleted and keep reappearing on Ctrl-Shft-A. I wonder if they are related to a line number where the editor if picking up some sort of error or unexpected End of File.
I've had enough of all this for today so I will sleep on it but any ideas would be a help.

confused-Techie commented 1 year ago

Super strange filenames you are seeing there.

I wonder, it almost looks like it's generating URIs, we haven't made many changes to our URIs but maybe one is accidentally being passed where it shouldn't?

Beyond that I'd probably have to take a look at the packages source code to really know, but I'd probably check to see if this package is using the URIs in any way to open and manage it's saved files?

ianwillie commented 1 year ago

Just an update. I am struggling with lack of familiarity wi Javascript, coffescript and node.js. However, this is being rectified by doing some learning on these subject helped by a knowledge of writing in other things like Fortran, Pascal, Python, R and DataBasic once upon a time. It does mean starting right at the beginning which will take a bit of time but I am maintaining interest in getting asciidoc-preview working in pulsar and supporting the project. Any advice on resources for learning the kind of node.js that is most appropriate to pulsar and asciidoc-preview would be most appreciated. I have found that there are virtually no comments of any description in the source code of 873 lines in all. That is not quite true because I did find about 12 comments but all seem to have been additions to the original program to manage bugs that appeared. So working out what each part of the program is doing is hard. for example "uriForEditor: (editor) -> "asciidoc-preview://editor/#{editor.id}" appears in main.coffee, line 114, with no explanation of how it relates to surrounding lines. This is mentioned in my comment 2 days ago as "asciidoc-preview://editor/7".

So I will be back doing more work on this soon. For now, I am stuck using atom 1.60.0 (or VSCodium etc) because for writing websites in AsciiDoc having an integrated preview which renders the code without all the styling and processing that occurs in a browser speeds up writing greatly. I am committed to community supported projects because over the years I have had work interrupted by large companies buying over small innovative software projects and either abandoning them or introducing licences that were so expensive as to be unavailable to mere mortals. But that is a discussion for another time in another place!

confused-Techie commented 1 year ago

@ianwillie I apploud your efforts to find this bug and learn JavaScript/CoffeeScript at the same time.

Really I'm not familiar with CoffeeScript at all myself, I just look at what little I know and try to convert to JavaScript in my head, this is largely why we want to remove CoffeeScript from Pulsar.

But to learn these, personally I think these are the best resources (but you may have already found them)

But that does seem interesting, if you'd like I'll try to take a look at it as well, and report any of the findings I'm able to see back here

ianwillie commented 1 year ago

Thanks for your support and encouragement. I used decaffeinate to translate the coffeescript to javascript. It is easier to make out what is going on. I have not tried running the js but only to see the full syntax. It looks OK but I have been doing little more than adding a few console.log statements to the coffee files. I see that plain javascript statements run fine in coffee files so it should be relatively easy to convert them to js bit by bit. What I have been trying to do is insert the correct path to the .adoc file in main.js and see if it will be rendered & previewed as expected. But I do not know enough about fs & path modules yet to get this working. Hence, stepping back to learn some basic node.js & javascript from the ground up. I can send you some of my files when I am a little bit further on with discovering things.

ianwillie commented 1 year ago

Here's an update on what I have been doing. 1) Learning node.js & more Javascript. (Thanks for your recommendations confused-Techie.) Discovered these resources "The Node Beginner Book: a comprehensice node.js tutorial" 59 pages & "The Node Craftsman Book: an advanced Node.js tutorial" c160 pages, both by Manuel Kiessling (a bundle for about $9. https://leanpub.com/b/node-beginner-and-craftsman-bundle , the printed books are quite expensive. The beginner book was highly recommended on some sites because it dealt with high level Javascript & Node for those familiar with programming but not with these languages. I found it great because I was quickly able to find out about how to get servers going, event driven callbacks, function passing, requests, responses and many other things I knew a little about but no idea how to program them in node & JS. This plus concepts like sync & async, event driven, dependency injection, blocking & unblocking, callbacks, function programming being about doing: verbs rather than things: nouns, functions calling functions as arguments. These descriptions of concepts were accompanied by references to important papers explaining how these concepts actually mattered in the world of Node. It gave program changes to demonstrate the effect of a complex linux shell "find" call blocking a program and how to overcome ysung async methods. There were examples of server programs initially using included procedures and how to compact these into function arguments to functions The author demonstrates how these techniques which might be used in other languages might minimise obscure bugs in node. Although written a while ago c2012 with node v0.4.9 the programs ran without modification on current node.js v16.19

All the programs given were fairly short, moderately high level and complete so that they could be implemented and run immediately. As a beginner I struggled with the excellent likes of JS MDN & Node.JS & nodejs.org because the examples given were snippets of code that were missing some essential components that would be second nature to experienced users but just not to someone unfamiliar with JS. With hindsight, I realise just how clear and complete these two website are. Thanks for the recommendation confused-Techie.

2) I searched about to find a good dump program to output the structure of objects and functions and it seemed that JS was a little light in this respect. However, I came upon a program based on dump in Coldfusion ( originally written as part of Macromedia's Dreamweaver which I used to use and loved until it was bought out and licensed by Adobe). https://www.npmjs.com/package/nodedump has a wonderful description of it with example code which will run directly in node.js. It produces in the server browser a graphical demonstration of the object using html tables which can be customised with arguments to the nodedump function. For example, headings of object names can be expanded and contracted by clicking on their title. This is most concise and should help to compare, for example, the structure of a working atom version with a later dysfunctional pulsar version and get some idea of where the problem lies.

That is where I am now having learnt JS enough to turn nodedump into a function which can be included as a module & function in asciidoc-preview to track down where the pulsar atom versions >=1.61 loose track of the filename to be rendered in html by comparing with the working atom 1.60.

3) I have worked out how to put together a node program that reads an asciidoc, adoc file, translates it to html and renders it in Firefox, refreshing the view on any change when the .adoc file was edited. This was accomplished withless than 20 lines of Node.js code. It seems to me that there must be a simpler way to re-implement asciidoc-preview.js as it exists in over 1000 lines of coffeescript into a new version. To recap, the current asciidoc-preview does not render text in Atom after V1.60 or in any present Pulsar version. I plan to look at Pulsar modules which render markdown and html correctly and see it they can be adapted to accommodate asciidoc and maybe other previews too. One of the complexities is likely to be that required to re-render the text view as changes are made to the .adoc file and not be dependent on saving the file first for changes to show.

EDIT: Minutes ago, just received a copy of 7th edition of David Flanagan's "Javascript: The Definitive Guide" much of which I can actually understand. In the past the 6th edition was over my head: so all this effort is definitely worthwhile. EDIT: By accident added a heart like emoji to my own post. Can't find out how to remove it: oh well!

confused-Techie commented 1 year ago

Love all the learning and effort going into this @ianwillie. please feel free to message me on here or Discord if you ever need any programming (in JavaScript assistance) and I'd be more than happy to help

ianwillie commented 1 year ago

Been working my way through Hacking the Core https://pulsar-edit.dev/docs/launch-manual/sections/core-hacking/.

It is great learning like solving a few issues ascii-art & here I suggest a few minor changes . I put them here because I don't know where else to suggest them.

To install figlet "npm install -g figlet". Actually, Ithink that I had to uninstall a previous version that was not accessible for some reason before installing a new version. To see it working use figlet.js on the command line, npm install -g figlet-cli then you should be able runfiglet -f "Dancing Font" "Hi". Look at figlet read.me https://github.com/patorjk/figlet.js/ for help.

Find figlet version npm list figlet & change"dependencies": { "figlet": "1.5.2" } or maybe just leave the number blank "".

ascii-art.js const font = 'o8' should read 'O8' with upper case O, but could be, for example, const font = 'Dancing Font'

Suggest keymaps/ascii-art.json "atom-text-editor": { "ctrl-alt-A": "ascii-art:convert" Use "A" instead of "a" which is used by asciidoc-preview.

These tutorials in Hacking the Core are such a help. Thanks.

ianwillie commented 1 year ago

@confused-Techie I have managed to put together a very much alpha package that previews an asciidoc file in a separate pane in pulsar. I am not sure where I should put this but it is not ready for github as a package. Anyroads I have attached a tar.gz of the package which can be installed in pulsar, I think. I say, I think, because I have never done this before and I imagine there may be more to this than I realise. Anyway there are quite lengthy instructions in README.md in the package but I will try pasting them as text here, which seem to work OK. I find that I can use the package in spite of its limitations. I think a big advantage is using asciidoctor.js which is based on the Ruby package of the same name and supported and maintined by the asciidoc. I look forward to responses and will value any advice or guidance anyone can give. Kind wishes to all and I hope that this is of help.

My version of an asciidoc-preview "ianasciidocpreview-active-editor-info"

This file can be found in ianasciidocpreview-active-editor-info/

This is my first attempt at developing a pulsar package. This is designed to replace asciidoc-preview which fails to preview asciidoc files in pulsar or atom after v1.60. This package ianasciidocpreview-active-editor-info has been developed from the package active-editor-info from Hacking Pulsar. It does work to render asciidoc files in a separate pane which can be scrolled or dragged to view the content and resized in width. There are a few quirks and unexpected behaviours which are described below. This is a development package and I am asking advice on how to resolve various problems from people who know more about pulsar, atom and node than I. Be aware that I take no responsibility for any untoward effects that installing package may have on your computer system: so be warned! In particular it might be better to replace innerHTML() with setHTML() which is supposed to sanitise any html before it is generated.

I would suggest that anyone interested follow the guide below on how to install and use the package. I have not contemplated putting it on github because it is at such an early stage of development and I am a beginner in this field and looking for advice.

Thanks for the help I have received up to nor, particularly from @confused-Techie & @Maurício Szabo.

I hope this is of help to someone.

Help needed

I could do with help on these issues which are evident at the moment.

/lib/ianasciidocpreview-active-editor-info-view file uses observeActivePaneItem() where I would have thought it more appropriate to use something related to the TextEditorPane. I have not been able to work out how to do this looking through the extensive lists of possibilities in the flight-manual.

    "this.subscriptions = atom.workspace.getCenter().observeActivePaneItem((item) => {
    let editor = atom.workspace.getActiveTextEditor();
    let words = editor.getText(); "

Probably related to that, I do not know how to get the preview to change when I save the .adoc file. The preview only changes when the focus pane is changed to another and back to the original. It shows the edited changes even though the file has not been saved.

I keep getting this error: Uncaught TypeError: Cannot read property 'getText' of undefined, lib/ianasciidocpreview-active-editor-info-view.js:28. I can see that the editor may be undefined but how do I skip this command in that case? This seems to appear when using markdown-preview package as well.

I hope to get some degree of scrolling so that they adoc and preview are in sync.

Installation

You may need to install asciidoctor.js with npm. See below for details and https://docs.asciidoctor.org/asciidoctor.js/latest/setup/install/

Download ianasciidocpreview-active-editor-info.zip to a directory like ~/Downloads & unzip.

Either, 1. copy the files to the directory ~/.pulsar/packages//home/ian/github/ianasciidocpreview-active-editor-info or

  1. create a symbolic link between ~/.pulsar/packages//home/ian/github/ianasciidocpreview-active-editor-info and the unzipped directory.

Restart pulsar. (This program was developed using cd ~/.pulsar/packages/ianasciidocpreview-active-editor-info; /Pulsar-1.103.2023040323.AppImage . --no-sandbox ) Your command to start pulsar will be different.

Navigate to ~/.pulsar/packages/ianasciidocpreview-active-editor-info and click on the asciidoc file DatesTEST.adoc. This should open in an editor pane and now place the cursor within it. There will be several .adoc files in this directory. Run the asciidoc previewing program by pressing together Ctrl-Alt-Shift-Y, or, Ctrl-Shift-P and entering ianasciidocpreview-active-editor-info: toggle, or, Menu Packages>ianasciidocpreview-active-editor-info: toggle.

You should see a panel open on the right showing the rendered asciidoc file. It may be necessary to enter the last command more than once because Ctrl-Alt-Shift-Y is a toggle to display or undisplay the preview panel.

Now if you click on to open asciidoc_syntax.adoc you will see scroll bars. Mouse dragging works but up/down arrow work and PgUp & PgDown do not work yet.

There will be several .adoc files in the ~/.pulsar/packages/ianasciidocpreview-active-editor-infos directory of different sizes. Choose the smallest asciidoc_syntax_VShort.adoc to start with. It will show no vertical scroll bars because it is so small. The largest file asciidoc_syntax.adoc has many lines and should show vertical scrollbars. If you navigate right to the end there is a media file which should run with sound, full screen and so on when you click the arrow. (asciidoc_syntax.adoc is an old version of the asciidoctor syntax demo file for latest syntax look at the asciidoctor website.)

The adoc preview panel can be opened and closed with the top-right X. The left edge can be clicked and pulled to enlarge. The vertical size is set in pixels in the program otherwise the scroll is not activated.

To see what is happening use the console.log. Output to this is dictated by "const consprint = false;". Open ~/.pulsar/packages/lib/ianasciidocpreview-active-editor-info-view.js and change to "const consprint = true;", without the quotes.Press Ctrl-Shift-I to turn on the console. You may need --no-sandbox on the pulsar command line for this to work. Then use Ctr-Alt-Shift-Y.

Each time the adoc file is previewed in addition an HTML file is created. The full path to this is indicated at the top of the preview panel. For some reason it is not possible to selected and save the text, nor click on it to open it at the moment.

Quirks

If you edit an .adoc file you will see no changes to the preview file until you open or click on another .adoc file panel and return to the original edited one. However, if you save the .adoc file you will not see any of the changes rendered until you do as suggested in the last sentence.

You will see error messages in the console about media files not found - but click on Show on Youtube and it works.

There are messages about missing css style files but the default asciidoc css file will be operating, I think.

Most of the URLs will not work because they are local files and the base directory is not set.

Uncaught (in promise) TypeError: Cannot read property 'getText' of undefined. I think related to handling previews of non-asciidoc type files. For a similar reason the title on preview panel may not be correct.

How I think the package works

It was created using the package generator and most of this has not been changed.

ianasciidocpreview-active-editor-info-view has been altered:

Tests

These seem to work but relate to the original active-editor-info and should be ignored.

Asciidoctor.js installation information from my system: (20230416)

  $ npm info  asciidoctor

  asciidoctor@2.2.6 | MIT | deps: 2 | versions: 26
  A JavaScript AsciiDoc processor, cross-compiled from the Ruby-based AsciiDoc implementation, Asciidoctor, using Opal
  https://github.com/asciidoctor/asciidoctor.js

  keywords: asciidoc, asciidoctor, opal, javascript, library

  bin: asciidoctor, asciidoctorjs

  dist
  .tarball: https://registry.npmjs.org/asciidoctor/-/asciidoctor-2.2.6.tgz

  dependencies:
  @asciidoctor/cli: 3.5.0  @asciidoctor/core: 2.2.6

  dist-tags:
  latest: 2.2.6        

  published a year ago by ggrossetie <ggrossetie@gmail.com>
  ian@ian-ManjSda11:~$ npm info  asciidoc

ianasciidocpreview-active-editor-info20230417.tar.gz

confused-Techie commented 1 year ago

So @ianwillie this is some impressive work, love that you got it to a point of being functional, and while not the most familiar with all aspects of this, there are some areas I'd be more than happy to help out with. Such as, you mention having trouble not acting when you receive a value that's undefined when trying to access a property of a method/class/function, you could do something like this:

if (typeof someMethod?.getText() === "string") {
  // Do stuff
} 

Using this, not only are you ensuring the type of whatever is returned, you are also using optional chaining to ensure you don't try to access a property that doesn't exist.

Or more simply you could wrap the entire method in a try...catch block:

try {
 let text = someMethod.getText();

  // Do stuff 
} catch(err) {
  // We now have an error here, and we can check what it is like
  if (err instanceof TypeError && err.message == "Cannot read property 'getText' of undefined") {
    // We know this error means we couldn't get text and we shouldn't do anything
  } else {
    // The error is something else. Maybe we want to give the user a notification?
  }
}

But otherwise what I'd personally suggest is to upload the code to GitHub anyway, uploading the code to GitHub doesn't mean it's complete, contrarily it means you are inviting others to help it become complete, or otherwise allowing others to actually read your code and provide much more helpful feedback, since otherwise I'm only guessing at what the code looks like.

If you do decide to upload it feel free to let me know here! And especially once you have it published to the pulsar registry I'd be happy to know, so that we can give people that install this package a way to find a working one. Hope this helps!

ianwillie commented 1 year ago

@confused-Techie Thanks for that. I will do as you say and upload the code to github. The entire code is in the post above as a tar file which can be viewed or decompressed to .pulsar, so you can actually read the code here. https://github.com/pulsar-edit/pulsar/files/11254205/ianasciidocpreview-active-editor-info20230417.tar.gz I accidentally closed this issue so it is re-opened.

ianwillie commented 1 year ago

@confused-Techie I created a repository on github from my local repository collecting and using a few tokens on the way. Then: '''Saving token to Keychain ✓ Unable to parse repository name/owner from package.json repository field ian@ian-ManjSda11:~/github/ianasciidocpreview-active-editor-info-gitTEST$ /home/ian/Downloads/Pulsar-1.104.2023041705.AppImage -p publish minor Unable to parse repository name/owner from package.json repository field ''' Here is the package.json file with .txt at end. It seems OK to me. Can you help please? package.json.txt

confused-Techie commented 1 year ago

Glad to see you published the repo to GitHub (Also small tip, now you can just send me a link to your repo, instead of asking people to download random files to their PC).

But looking it this real fast it seems it's valid. Now you don't have to publish this to the Pulsar Package Registry if you don't like, but otherwise if you would, I'd recommend taking a look at our publishing docs to make sure you've completed all the other steps.

And at this point may be a good idea to move our conversation to another discussion or something if we'd like, since we've gotten a little ways away from the original topic.

But feel free to ping me elsewhere or here (whatever works) and hope the docs work!

ianwillie commented 1 year ago

@confused-Techie Thanks for advice about how to manage all this: it is very new to me. I get your point about now having a repository there is no need to send files and so on. Also that we have got a bit off topic on this thread. Would this be what to do? 1) Recreate the package & repository & place on github naming it to something more meaningful like acidoctor-preview-pulsar-edit. ( It uses asciidoctor.js to convert from .adoc to .html which is subtly different from ascidoc.xx versions, I understand.) The current one that does not work on pulsar is called asciidoc-preview. 2) Clean up this thread to end it with a link to the github repository. 3) Start a thread on Discord saying that it exists by linking to it and use that for future discussions about it. 4) Not put it up as a pulsar package but leave it on github till it is more mature. Kind wishes.

confused-Techie commented 1 year ago

No worries, glad to see youre taking the time to learn things as needed then!

  1. Honestly, youre repo has a perfectly fine name. You can change it or upload your package again to GitHub under a different name, but only if you want to, what you have right now on GitHub is totally fine, if you like it. And once it is eventually uploaded to the Pulsar Package Registry, Pulsar will use whatever name is put in your package.json file, rather than the name of the repo on GitHub.
  2. No need to clean up here, but yeah ending it off for now with a link to your repo would be awesome!
  3. But yeah a thread on Discord could work if you'd like to talk further about this, or we could start an issue over on your repo itself, whatever you'd like
  4. Then lastly yes, once you feel your package is ready getting it uploaded to the Pulsar Package Registry would then fix the problems here for not only you, but everyone that uses Pulsar!
ianwillie commented 1 year ago

Thanks for that @confused-Techie . I've not forgotten about this and thanks for your advice which I will follow. I've been exploring using existing resources like markdown-preview, atom-browser, atom-html-preview and atom-multitheme-applicator (can't remember name quite), or just using an external browser. The first two do most of what I am looking for and the last we end up doing anyway. I am putting something together to be able to use them from the package which I put on github. It will be a bit of time till all this happens cos there is a huge amount to learn with pulsar package development.

ddreggors commented 8 months ago

I am trying to read through the comments here, but I am unsure if this is the start of a new plugin or an attempt to repair the existing plugin. In light of that I have questions...

What is the direction here? Is there any movement here?

confused-Techie commented 8 months ago

@ddreggors A quick summary of the conversation here.

It seems the package itself is broken, and changes likely need to be made within the package to fix this. But the package asciidoc-preview is a community package, meaning it's entirely made and maintained by community members like yourself.

But asciidoctor/atom-asciidoc-preview has been archived, meaning the package itself, if the issue is truly within the package, can never be repaired. Meaning a community member needs to fork the package and fix it, then republish, or a new package would need to be created.

The previous commenter here set out to do exactly this, create a new package to provide this functionality. Although it's been about 6 months since the last activity on their repo, so I'm unsure of their current progress.


Otherwise, now that we do bring this up again, it seems that asciidoc-preview may be a great candidate for the Pulsar Cooperative Program

ianwillie commented 8 months ago

@ddreggors @confused-Techie I'm glad to hear that someone is interested. I do have a working version o my asciidoctor preview that I am this very day about to push to github https://github.com/ianwillie/ianasciidocpreview-active-editor-info . I am quite new to using github and it will take me a few hours (maybe days) to sort out how to update this so that it clones properly.

My version is simple it will preview an .adoc file in a pane using asciidoctor.js encapsulated in html. The resulting preview styled using asciidotor.css can be resized, scrolled and zoomed. However, syncing the .adoc & preview has defeated me so far because I can't work out how to get internal links (<div id="mytarget"> ... <a href="#mytarget">) , or something similar, which work fine in a browser to work in a pulsar pane. This means that after an .adoc update and save the preview always reloads at the start of the file and not where if was before the save. This will be reported as an issue for which I would like help when the latest version is finally pushed.

This is very much a developing project but I do use it for a web site management every day and it works for me. There are a few bugs and quirks which need ironing out. My intention is to write the app in standard html as far as possible and avoid use of webview or electron ipc . The idea is that any changes to ipc or webview being deprecated should not affect the app. It should be independent of nodejs versions. I will try to get the latest working version pushed today and put a note to that effect here. I am a relative beginner in this kind of programming so please be aware.

I have had a look at pulsar markdown-preview from pulsar core and it should be quite simple to substitute asciidoctor.js for the renderer, or so I THINK! However, I have failed to get the current markdown-preview to compile because it seems to have dependencies that expect nodejs v18 which is higher than the version used by pulsar. I am not sure how to proceed with this and have not explored any farther.

Thanks for your interest and help.

EDIT 20231108 I've just updated https://github.com/ianwillie/ianasciidocpreview-active-editor-info and downloaded a clone to test and it appears to be OK. I am not sure about installation but putting the package in ~/.pulsar should work. A link should work too. The read.md is a bit out of date but the first paragraphs are accurate. All the commands for the package are preluded with Ctrl-Shift-Alt keys. With the cursor placed in an open .adoc file in pulsar these three keys held down simultaneously with a Y should open a Right pane with a preview. The three keys with a + or a - key will zoom in or out. There is also a packages menu entry for the preview but not for the zoom.

Please let me know if it seems to work. But it is definitely work in progress and is getting more attention as I learn more thanks to all of you for help.

dadreggors commented 7 months ago

I followed instructions, and I see the package loaded in Pulsar, but when I try to toggle nothing opens and I get this error in devloper console:

fs.js:476 Uncaught (in promise) Error: ENOENT: no such file or directory, open './temp/XXXasciidocInputFromEditor_words'

ianwillie commented 2 months ago

@confused-Techie .

An update on asciidoc-preview.

I have followed your suggestion and adapted markdown-preview to preview asciidoc source code. In brief, using asciidoctor.js as the renderer virtually everything functions as expected but extensive changes were needed to the package. However, I would like some advice as to how to proceed. Basically I have copied the pulsar markdown-preview bundled package and extensively adapted it. This has involved changing much of the code removing chunks that are not relevant, adapting css & styling and making changes where the functionality is contained in asciidoctor.js. All references to markdown have been removed. Technically this is a fork but in reality it will end up being a rewrite greatly inspired by markdown-preview and support from yourself and others.

My inclination is to set it up on github as a separate entity rather than a fork of markdown-preview but underlining my great debt to that package. How would you suggest I proceed? You have given me valuable advice for this project often before.

Here is a summary of what works so far: magically almost everything. But I have to add that it has taken me a year to learn amongst many other things js, cofeescript (a bit), git, the intricacies of pulsar (and the confusion caused by sunsetting of much of atom help). On the way I wrote my own preview package https://github.com/ianwillie/ianasciidocpreview-active-editor-info which was a learning exercise really and explored unsuccessfully extending (atom-)asciidoc-preview which stopped working due to changes in electron versions.

What DOES WORK so far "iansasciidoc-preview-frommarkdownpreview" ( temporary name).

greyp9 commented 1 month ago

Any progress on this one? I think I'm seeing similar (MacOS 14).

Screenshot 2024-05-20 at 13 08 12 Screenshot 2024-05-20 at 13 07 37

It seems like something that would be easily diagnosed by a Pulsar dev. Even if it is lower priority, it would be nice to identify the cause.

BTW, nice implementation! I never used Atom, but looking for a good general-purpose editor.

savetheclocktower commented 1 month ago

@greyp9 I'd suggest installing @ianwillie's package as follows to see if it works for you:

pulsar -p install ianwillie/ianasciidocpreview-active-editor-info
savetheclocktower commented 1 month ago

My inclination is to set it up on github as a separate entity rather than a fork of markdown-preview but underlining my great debt to that package. How would you suggest I proceed? You have given me valuable advice for this project often before.

@ianwillie, if you're asking how to communicate that it's mainly copied from markdown-preview, I wouldn't worry about it. All of Pulsar's code is MIT-licensed; you may use it for any purpose you wish, as long as you mention that you're using MIT-licensed code. It's not a fork of anything; it's just a port of the general approach of markdown-preview to a different system.

greyp9 commented 1 month ago

@greyp9 I'd suggest installing @ianwillie's package as follows to see if it works for you:

pulsar -p install ianwillie/ianasciidocpreview-active-editor-info

The install appears to have worked:

% pulsar -p install ianwillie/ianasciidocpreview-active-editor-info
Cloning https://github.com/ianwillie/ianasciidocpreview-active-editor-info.git ✓
Installing modules ✓
Moving ianasciidocpreview-active-editor-info to [~]/.pulsar/packages/ianasciidocpreview-active-editor-info ✓
% 

I see the new options on right-click of an adoc.

Screenshot 2024-05-20 at 15 29 08

But selecting "toggle" does not appear to do anything.

savetheclocktower commented 1 month ago

I think you want “BrowserPopup” or its key equivalent.

EDIT: OK, maybe not. Perhaps @ianwillie can help you. ;-)

greyp9 commented 1 month ago

Thanks.

"Toggle" and "BrowserPopup" do not seem to do anything. "ZoomUp" and "ZoomDown" cause the display of an exception:

Screenshot 2024-05-20 at 17 21 09

stack trace:

Uncaught Error: ENOENT: no such file or directory, open 'temp/iansasciidocpreviewtransformscale.txt'

internal/fs/utils.js:307
[Hide Stack Trace](https://github.com/pulsar-edit/pulsar/issues/256#)
Error: ENOENT: no such file or directory, open 'temp/iansasciidocpreviewtransformscale.txt'
    at Object.openSync (fs.js:476:3)
    at Object.func [as openSync] (electron/js2c/asar_bundle.js:5:1846)
    at Object.writeFileSync (fs.js:1467:35)
    at Object.transformScaleUp (ianasciidocpreview-active-editor-info.js:205:12)
    at HTMLElement.ianasciidocpreview-active-editor-info:transformScaleUp (ianasciidocpreview-active-editor-info.js:42:80)
    at CommandRegistry.handleCommandEvent (/Applications/Pulsar.app/Contents/Resources/app.asar/src/command-registry.js:405:43)
    at CommandRegistry.dispatch (/Applications/Pulsar.app/Contents/Resources/app.asar/src/command-registry.js:292:17)
    at AtomEnvironment.dispatchContextMenuCommand (/Applications/Pulsar.app/Contents/Resources/app.asar/src/atom-environment.js:1598:19)
    at EventEmitter.outerCallback (/Applications/Pulsar.app/Contents/Resources/app.asar/src/application-delegate.js:306:47)
    at EventEmitter.emit (events.js:315:20)
    at Object.onMessage (electron/js2c/renderer_init.js:93:925)
greyp9 commented 1 month ago

Do you have any reports that asciidoc-preview works in Pulsar for any user? It would be different if it fails to work for some class of users. But maybe this is something where the plugin has different expectations for its underlying environment because it was written to work with Atom.

greyp9 commented 1 month ago

Here is a sample adoc that would be sufficient for a quick verification:

= test

== test

=== test
savetheclocktower commented 1 month ago

Do you have any reports that asciidoc-preview works in Pulsar for any user? It would be different if it fails to work for some class of users. But maybe this is something where the plugin has different expectations for its underlying environment because it was written to work with Atom.

Honestly, I don't know. It's not popular enough of a package for us to know that sort of thing. The only major thing we've done since forking from Atom (the only thing that would affect package compatibility, anyway) is bump the version of Electron. That comes with its own bump of Node, so either of those things could result in an incompatibility.

If any of us used AsciiDoc ourselves, or had need for an AsciiDoc package, we'd be able to get this fixed. But since we don't, it hasn't been a priority. If I get a moment I'll at least try to run asciidoc-preview and troubleshoot what's gone wrong.

savetheclocktower commented 1 month ago

OK, the good news is that the fix seems to be pretty easy. If it had been more involved than this I don't know if I would've had the stamina.

I cloned the original repo and ran it locally. I managed to discover that the preview view was being created, but then nothing else was happening. I added one extra function call in the constructor and that seems to have gotten it working for me locally.

@greyp9, revert what I had you do earlier:

pulsar -p uninstall ianwillie/ianasciidocpreview-active-editor-info

Instead, please first uninstall any existing copy of asciidoc-preview you may have installed. Then do this:

pulsar -p install savetheclocktower/atom-asciidoc-preview

This ought to get things working again.

I don't plan to maintain this package, but I don't plan to delete that fork from my repo, either. If you were paranoid, you could fork my fork just to have an archived copy somewhere.

confused-Techie commented 1 month ago

@savetheclocktower As the original package seems to have been archived, this could be a great use case for pulsar-cooperative, if you think you'd be willing to supply a PR with that fix.

Or otherwise if you're confident in it I can just go through the commit history.

Honestly considering this issue was opened before pulsar-cooperative even existed it seems this might be a great use case. I may make an issue over there to that extent, but I don't want to undo the awesome work by previous commenters working to resolve this issue

ianwillie commented 1 month ago

Hi everyone, I have been pondering this and here are a few first thoughts on the subject. About a year ago I discovered, like others, that atom-asciidoc-preview had stop rendering the preview in that last update of atom & an update of pulsar-edit. Then I started exploring writing my own package using fairly simple html as I learned about package writing in pulsar-edit. This worked in a limited sort of way. After that suggested by others, like @confused-Techie, I explored adapting pulsar markdown-preview. It proved remarkably easy to adapt this to render using asciidoctor.js. This relied on using older language packages for rendering and syntax highlighting. Then there was interest shown by others (like @savetheclocktower & @confused-Techie) in updating markdown-preview with Treesitter grammars & parsers. This was great but broke the package that I was developing. These fine changes to markdown-preview have continued and when these settle a bit then I will fix the package that I was just about to put on github which would preview both markdown and asciidoctor (.adoc) files.

My conclusion (at the moment!) is that fixing atom-asciidoc-preview is great but in the long term it will be far preferable to extend markdown-preview because maintenance will be straightforward after the current version settles down with the Treesitter language tools. atom-asciidoc-preview seems a fairly complex package while markdown-preview is much simpler to comprehend, is uptodate now and will be maintained as a pulsar core package. Relying, for the html generation, on asciidoctor.js which is maintained by the asciidoctor organisation relieves us of the need to maintain that side of it. Almost all configuration can be written into each asciidoctor source file and there is no need for the preview package to handles these. Such configuration includes the likes of table of contents, css file source, choice & management, how security matters are handled (unsafe, server, secure), what highlighter to use (highligh.js, rouge, etc) generally in front matter.

Markdown-preview can easily be extended to have the ability to preview asciidoctor files because I have done it and use it. Alternatively a fork which previewed asciicoctor files but not markdown could be maintained. Again, I have done this and use it. These versions that I have written are programmers version which work and rely on changes being added to code rather than a config file. So, at this point, they are not for public consumption, but are proof of concept. In the near future I will get some of this onto github.

These are first thoughts and I will return and edit this adding details of the source references.

Many thanks to all who have helped me on the way to grasping how to write packages for pulsar-edit.
Kind wishes, Ian.

dadreggors commented 1 month ago

OK, the good news is that the fix seems to be pretty easy. If it had been more involved than this I don't know if I would've had the stamina.

Instead, please first uninstall any existing copy of asciidoc-preview you may have installed. Then do this:

pulsar -p install savetheclocktower/atom-asciidoc-preview

This ought to get things working again.

This worked on my copy locally.