Closed dadreggors closed 7 months ago
I wonder if you have asciidoctor.js installed? The nodejs package asciidoctor.js is required.
In terminal cd to your project directory where the asciidoc (.adoc) file you wish to preview exists. Then one of
npm asciidoctor
or
npm asciidoctor -g
should show asciidoctor as presence.
Mine shows:
npm list
<currentPath>
├── @asciidoctor/reveal.js@5.0.0-rc.1
└── asciidoctor@2.2.6
Then
asciidoctor <inputFile>.adoc -o -
should show the html output, or
asciidoctor <inputFile>.adoc
will write
If asciidoctor.js is not installed look at https://docs.asciidoctor.org/asciidoctor.js/latest/setup/install/ for guidance.
A caveat: I am very new to javascript, node and this is the first pulsar package that I have created. So please bear with my learning how to work these problems out. At the moment there are no test programmes to test for simple problems with paths and the like.
Please let me know how you get on.
I wonder if you have asciidoctor.js installed? The nodejs package asciidoctor.js is required.
As I mentioned in my initial comment, I do have asciidoctor installed as directed in your instructions.
I have just pulled the latest code, and following instructions I installed asciidoctor via npm.
$ npm list
ddreggors@ /home/ddreggors
└── asciidoctor@3.0.3
I have tested asciidoctor test.adoc -o -
and it does show html output for the test document.
I am also not very knowledgeable on node OR atom/pulsar packages so we will muddle through lol.
I noted that the missing file seems to be ./temp/XXXasciidocInputFromEditor_words
so it seems the package expects to make a temporary file from the editor input (what you have open in your tab?) to be able to build the preview from the temporary file. That file is either not getting created or the code is looking in the wrong path for it
ok so looking at your source code I see this:
fs.writeFileSync(htmloutputDir + "temp/XXXasciidocInputFromEditor_words", asciidocInputFromEditor_words); // file with original .adoc which is in string words the original asciidoc file - just to check
// write out raw file created by asciidoctor.js that can be read by browser
fs.writeFileSync(htmloutputDir + htmloutputFileRawFromAsciidoc, htmloutput);
console.log(`Just written htmloutputFileRawFromAsciidoc = ${htmloutputFileRawFromAsciidoc}` );
So I created a new folder and file under lib (templ/XXXasciidocInputFromEditor_words
) and the error now goes away. However, nothing happens now at all. I do not see anything change and I am not sure where that console.log
line is supposed to log to but I do not see that text appear anywhere. Also the new file I created has nothing in it.
I will dig deeper and see if I can figure out where htmloutputDir + htmloutputFileRawFromAsciidoc
and also the console.log is showing up.
EDIT: I now have created both files:
$ ls -l lib/temp
total 0
-rw-r--r--. 1 ddreggors ddreggors 0 Jan 29 10:18 iansasciidocpreviewhtmloutput.html
-rw-r--r--. 1 ddreggors ddreggors 0 Jan 29 09:47 XXXasciidocInputFromEditor_words
However, they remain at 0 size and nothing happens in the editor when I toggle the package.
I still do not see a way to see the console.log output anywhere, I have installed several console packages and they do not appear to capture your console.log output. Probably me not understanding where I am supposed to see this.
I got console.log working (ctrl-shift-i) finally by adding --no-sandbox
Now I see the errors:
ianasciidocpreview-active-editor-info/lib
but rather in same folder as your adoc file (~/tmp
in my case) Uncaught (in promise) ReferenceError: previewWidth is not defined
at getTextOpenWrite (ianasciidocpreview-active-editor-info-view.js:187)
at ianasciidocpreview-active-editor-info-view.js:408
at Workspace.observeActiveTextEditor (/opt/Pulsar/resources/app.asar/src/workspace.js:866)
at new IanasciidocpreviewActiveEditorInfoView (ianasciidocpreview-active-editor-info-view.js:57)
at ianasciidocpreview-active-editor-info.js:28
at Workspace.createItemForURI (/opt/Pulsar/resources/app.asar/src/workspace.js:1408)
at Workspace.open (/opt/Pulsar/resources/app.asar/src/workspace.js:1171)
getTextOpenWrite @ ianasciidocpreview-active-editor-info-view.js? [sm]:187
(anonymous) @ ianasciidocpreview-active-editor-info-view.js? [sm]:408
observeActiveTextEditor @ /opt/Pulsar/resources/app.asar/src/workspace.js:866
IanasciidocpreviewActiveEditorInfoView @ ianasciidocpreview-active-editor-info-view.js? [sm]:57
(anonymous) @ ianasciidocpreview-active-editor-info.js? [sm]:28
createItemForURI @ /opt/Pulsar/resources/app.asar/src/workspace.js:1408
open @ /opt/Pulsar/resources/app.asar/src/workspace.js:1171
async function (async)
open @ /opt/Pulsar/resources/app.asar/src/workspace.js:1107
toggle @ /opt/Pulsar/resources/app.asar/src/workspace.js:1336
toggle @ ianasciidocpreview-active-editor-info.js? [sm]:384
ianasciidocpreview-active-editor-info:toggle @ ianasciidocpreview-active-editor-info.js? [sm]:62
handleCommandEvent @ /app/Pulsar/resources/app.asar/src/command-registry.js:405
module.exports.KeymapManager.dispatchCommandEvent @ /app/Pulsar/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:617
module.exports.KeymapManager.handleKeyboardEvent @ /app/Pulsar/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:408
handleDocumentKeyEvent @ /app/Pulsar/resources/app.asar/src/window-event-handler.js:153
undefined error is caused here
if (consprint) {console.log(transformScale); console.log(previewHeight); console.log(previewWidth); }
which should be previewPaneWidth
not previewWidth
I will try to create a merge request for this. Also, the path for temp file should be contained under package not under any given folder the user may have stored there asciidoc files. I will try to include that change in my merge request as well.
@ianwillie please review my merge request. This removed all but 1 'File not found' error and also creates the temp folder in the correct location (under package install path).
I would add that 1 file remains missing (atom-browser.less
) which I cannot see how you pull that one in
EDIT: Solved this one. From CHANGELOG.md:
atom-browser.less missing colsole. message sorted.
Link below removed from ...view file. atom-browser was explored to look at its interesting Zoom bar.
Removed from lib/...view.js: hN += <link rel="stylesheet" href="/home/ian/.pulsar/packages/ianasciidocpreview-active-editor-info/styles/atom-browser.less">\n
;
From memory atom-browser is one of the packages based on, is it webview, or something similar.: it is a well written and useful viewer, I recall. Whatever that "webview" package in eclipse is called, it is deprecated and will be removed in some future version of eclipse, I recall. That will mean that most of the pulsar preview packages will stop working. I think if atom-browser package is uninstalled, or perhaps inactivated, the error will vanish.
That is why I have tried to create a package which uses pretty basic html5 which is unlikely to change. To some degree I have been successful, but the limitations on the capabilities of the package are a major drawback.
I hope that I have resolved the issues with missing files, so I am closing this. I have also created a branch "Test_Changing_htmloutputDir" which addresses a related issue and puts the temp directory is /home/ instead of the project directory.
I hope that I have resolved the issues with missing files, so I am closing this. I have also created a branch "Test_Changing_htmloutputDir" which addresses a related issue and puts the temp directory is /home/ instead of the project directory.
I have just pulled the latest code, and following instructions I installed asciidoctor via npm.
When toggling your preview I get an error in pulsar (1.113.0):
Uncaught Error: ENOENT: no such file or directory, open './temp/XXXasciidocInputFromEditor_words'
Commands
Non-Core Packages