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

Adds package.json #95

Merged
merged 5 commits into from
Sep 28, 2016
Merged

Adds package.json #95

merged 5 commits into from
Sep 28, 2016

Conversation

ggrossetie
Copy link
Member

The goal is to make this backend easily available on the Node ecosystem.
I've created a simple converter for Jade templates (compiled in JavaScript with Opal) that will be available soon on npmjs: https://github.com/Mogztter/asciidoctor-template.js

When both projets will be published on npmjs, a user will be able to convert an AsciiDoc document into a Reveal.js presentation as follows:

npm install asciidoctor.js # AFAIK this is only required on npm 2.x
npm install asciidoctor-reveal.js
// Loads Asciidoctor.js + Asciidoctor-template.js
var asciidoctor = require('asciidoctor.js')();
var Asciidoctor = asciidoctor.Asciidoctor();
var Opal = asciidoctor.Opal;
Opal.load('nodejs');
Opal.load('pathname');
require('asciidoctor-template.js');

var options = Opal.hash({'safe': 'safe',
                         'template_dir': 'node_modules/asciidoctor-reveal.js/templates',
                         'backend': 'revealjs'});

var content = '...'; // AsciiDoc content
var result = Asciidoctor.$convert(content, options); // Congrats you have a Reveal.js presentation !

Feel free to add authors and a better description 😄

@mojavelinux
Copy link
Member

This is good. In the future, though, I'd really like to set a goal that the converter can be loaded through the backend option instead of referencing the templates directly. That's a matter of creating a Ruby or JavaScript-based converter class that sets up the template (and/or composite) converter and points it at the templates.

@ggrossetie
Copy link
Member Author

Since I'm using a custom template converter I can add a default value when running on Node:

if backend == 'revealjs' && running_node
  template_dir = template_dir || 'node_modules/asciidoctor-reveal.js/templates'
end

@mojavelinux Is this what you have in mind ?

@mojavelinux
Copy link
Member

That's a good interim step. I'd still like to see a custom converter introduced to manage the wiring because it can do other things such as set the basebackend and htmlsyntax attributes. In other words, official converters should always be registered formally with the API. Using templates "ad-hoc" is only meant to be an end-user customization.

@ggrossetie
Copy link
Member Author

I've just noticed that @obilodeau is working on an "official" converter registered with the API.
#93

But AFAIK this won't work in a JavaScript environment.

Currently there's multiple issues with template converter backend in JavaScript:

  • it's hard to locate and load files on various JavaScript environments (especially when running in a browser)
  • composite converter is not working (didn't dig too much)
  • requires complex setup (git clone, require(), template_dir...)

But I still think that the template converter backend is great for end user customization.

However "official" converters should be easier to use/integrate. Maybe we should rewrite this converter in Ruby like the html5 converter ? But that's another subject :)

@cmoulliard
Copy link
Member

Is this what you have in mind ?

I like the by default value that you suggest

@obilodeau
Copy link
Member

For me this is a complex change to handle since I don't fully understand all of the stuff that is going on. That said, I'm willing to integrate anything that makes using AsciiDoc (including asciidoc[tor] + reveal.js) simpler as long as someone is around when issues arises.

However there are two things I want to say here:

First, you need to add some documentation about it in the README. Even if I would like to test what you propose I have no idea how to do so. Some doc would help me (and others) for sure.

Second is that I'll let @mojavelinux give the final 👍 on this one. Since he's the one who understands all the moving pieces the most.

Since reveal.js is a node project I think this can't be a bad thing to have this back-end published over there as well. Thanks for that!

@ggrossetie
Copy link
Member Author

For me this is a complex change to handle since I don't fully understand all of the stuff that is going on. That said, I'm willing to integrate anything that makes using AsciiDoc (including asciidoc[tor] + reveal.js) simpler as long as someone is around when issues arises.

Sure, that's fair enough, I will be around 😉

First, you need to add some documentation about it in the README. Even if I would like to test what you propose I have no idea how to do so. Some doc would help me (and others) for sure.

I didn't know how to integrate with the current README, I think we will need to restructure the sections a bit. Currently the "Prerequisites" and "Rendering the AsciiDoc into slides" sections explain how to use Reveal.js templates with Asciidoctor Ruby.
So we will need to create a section/subsection to explain how to setup and use this backend with Asciidoctor.js. Wdyt ?

Second is that I'll let @mojavelinux give the final 👍 on this one. Since he's the one who understands all the moving pieces the most.

Ok

Since reveal.js is a node project I think this can't be a bad thing to have this back-end published over there as well. Thanks for that!

👍

@obilodeau
Copy link
Member

I didn't know how to integrate with the current README, I think we will need to restructure the sections a bit. Currently the "Prerequisites" and "Rendering the AsciiDoc into slides" sections explain how to use Reveal.js templates with Asciidoctor Ruby.
So we will need to create a section/subsection to explain how to setup and use this backend with Asciidoctor.js. Wdyt ?

Yes, do some intro like: there are two ways to use this back-end with varying levels of functionality. Then put all the ruby specific in a section and the javascript specific in another. Don't worry too much about phrasing, we can fix that later. As long as the steps are there for me to try the back-end.

@ggrossetie
Copy link
Member Author

I found an issue, when using a Node package reveal.js directory is not available in the root folder but in node_modules/asciidoctor-reveal.js/node_modules/reveal.js.

To workaround this issue we can simply create a link: ln -s node_modules/asciidoctor-reveal.js/node_modules/reveal.js but that's not great.

Instead I think we should add a global variable to set the "reveal.js base directory": https://github.com/asciidoctor/asciidoctor-reveal.js/blob/master/templates/jade/document.jade

-    link(href="reveal.js/css/reveal.css",rel="stylesheet") 
+    link(href="#{revealjs_base_dir}/css/reveal.css",rel="stylesheet") 

@cmoulliard
Copy link
Member

I think that this is a good idea to setup this revealjs_base_dir as most probably revealjs will be installed separately from the templates and should be available from the HTML folder containing the Revealjs slideshow.

@obilodeau
Copy link
Member

Can't you just tell the user how to configure the existing :revealjsdir:
attribute in the documentation?

Most people I know who use revealjs fork it to add a custom theme. Using
the attribute is the way to do it.

On Mon, Sep 19, 2016, 11:34 AM Guillaume Grossetie [email protected]
wrote:

I found an issue, when using a Node package reveal.js directory is not
available in the root folder but in
node_modules/asciidoctor-reveal.js/node_modules/reveal.js.

To workaround this issue we can simply create a link: ln -s
node_modules/asciidoctor-reveal.js/node_modules/reveal.js but that's not
great.

Instead I think we should add a global variable to set the "reveal.js base
directory":
https://github.com/asciidoctor/asciidoctor-reveal.js/blob/master/templates/jade/document.jade

  • link(href="reveal.js/css/reveal.css",rel="stylesheet") + link(href="#{revealjs_base_dir}/css/reveal.css",rel="stylesheet")


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#95 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAhWFYX24u8KXsysH1xwH6-bitEdhPRVks5qrqqlgaJpZM4J9Jym
.

@ggrossetie
Copy link
Member Author

Sure but revealjsdir is only defined in Slim templates not in Jade templates. Maybe we should add a task on #63 ?

@obilodeau
Copy link
Member

It's not up to the template engine. AsciiDoc document attributes are available in both engines as it is provided by the core. It's just that the Jade template designer chose not to use it (for a reason he didn't explain).

Task added to #63.

revealjs_base_dir vs revealjsdir

Please absolutely refrain from introducing new revealjs specific attributes if they already exist for slim. This will only make multi-engine maintenance more complicated.

@ggrossetie
Copy link
Member Author

I didn't know about revealjsdir, I'm fine with the naming.

It's not up to the template engine. AsciiDoc document attributes are available in both engines as it is provided by the core.

When I said "only defined", I meant "only used" in Slim templates.

It's just that the Jade template designer chose not to use it (for a reason he didn't explain).

I think it's not on purpose since I don't see any real drawback... ?

@obilodeau
Copy link
Member

Agreed. Not knowing it existed is a perfectly valid reason not to use it. I
just assumed (wished) he took inspiration from the slim template.

On Mon, Sep 19, 2016, 5:34 PM Guillaume Grossetie [email protected]
wrote:

I didn't know about revealjsdir, I'm fine with the naming.

It's not up to the template engine. AsciiDoc document attributes are
available in both engines as it is provided by the core.

When I said "only defined", I meant "only used" in Slim templates.

It's just that the Jade template designer chose not to use it (for a
reason he didn't explain).

I think it's not on purpose since I don't see any real drawback... ?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#95 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAhWFfg4pSJE42So3cHVerL_OdWfrVyDks5qrv2tgaJpZM4J9Jym
.

Copy link
Member

@obilodeau obilodeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not able to test since the packages are not in the npm registry. See inline comments. I suggest you provide instructions on how to test the whole thing in HACKING.adoc.

For me what is important as an outsider to the javascript/node ecosystem is what I can independently reproduce with your instructions (and with the least effort).

Thanks for taking the time to educate me and others! Improvements to the documentation will increase the number of users and ease the path to contributors.


Using npm:

$ npm i -g npm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: I'm a node/javascript n00b.

Why the global install of npm (with npm!?)? On my arch linux setup npm is managed by my package manager and I don't want to change that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm is the toolset required to manage on your machine the nodes modules/packages. This toolbox is installed globally along your node distribution. The goal of this command is to be sure that npm is up to date : https://docs.npmjs.com/getting-started/installing-node#updating-npm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took inspiration from https://github.com/lodash/lodash#installation, the only hard requirement is to have npm available on your PATH. So basically if you install Node.js you are good to go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you simply add a Prerequisite section with Node.js then. Link it to the website. This way people will figure out how to install it on their own based on their requirement, preference, system, knowledge, etc.


$ npm i -g npm
$ npm i --save asciidoctor.js
$ npm i --save asciidoctor-reveal.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/asciidoctor-reveal.js

So how can I test locally?

I tried using npm link, even as root (which I hate doing) and it always failed because of a missing dependency on asciidoctor-template.js:

npm ERR! 404  'asciidoctor-template.js' is not in the npm registry.

So I tried doing a sudo npm link inside a checkout of asciidoctor-template.js and it worked but a subsequent sudo npm link from asciidoctor-reveal.js still failed like if asciidoctor-template.js was not installed:

npm ERR! 404  'asciidoctor-template.js' is not in the npm registry.

Sorry for my lack of experience but I tried. Can you help me here?

Copy link
Member

@cmoulliard cmoulliard Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module asciidoctor-reveal.js hasn't been yet published on npmjs.com server (https://www.npmjs.com/search?q=asciidoctor-reveal.js). This is why you an error 404.

If you use this command npm link /path, you can copy the package from this project cloned locally on your machine https://github.com/Mogztter/asciidoctor-reveal.js (use node-package branch please) to the folder where you would like to test.

Remark: As the project asciidoctor-template hasn't been also published on npmjs server, then you must clone & copy the path to install the modules

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, I will publish a "beta" version in the npm registry, to make things easier.

$ npm i --save asciidoctor.js
$ npm i --save asciidoctor-reveal.js

In Node.js:
Copy link
Member

@obilodeau obilodeau Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You provide the filename and the content, which is good but then how do you invoke the actual rendering? It is unclear to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Guillaume wants to say here is that : "Create a node.js file containing the required info to configure Asciidoctor (Opal, modules, Attributes, ...) and next you can run it on your machine using the command node node.js

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following line is calling the Asciidoctor API to render the document: Asciidoctor.$convert_file('presentation.adoc', options);

I you want to provide the content, you need to use Asciidoctor.$convert(content, options);

var options = Opal.hash({safe: 'safe',
template_dir: 'node_modules/asciidoctor-reveal.js/templates',
backend: 'revealjs'});
var result = Asciidoctor.$convert_file('presentation.adoc', options);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that presentation.adoc is a filename and that it is related to what you are trying to render is important and should be clarified in the documentation outside the code listing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@cmoulliard
Copy link
Member

Here are the bash instructions that you can use to create and test a node project using Guillaume's modifications.

Instructions : Create a bash file, change the permissions (chmod +x file) & execute it within a folder

#!/usr/bin/env bash

echo "## Cleanup & create folder"
rm -rf lib/
rm -rf reveal.js-3.3.0
rm -rf node_modules/
rm reveal.js.zip
rm *.js
rm *.json
rm *.adoc
rm *.html
rm *.log

mkdir lib
cd lib 

echo "## Clone Asciidoctor-template, install node modules"
git clone https://github.com/Mogztter/asciidoctor-template.js.git
cd asciidoctor-template.js
npm install
npm run dist
cd ..

echo "## Clone Asciidoctor-revealjs"
git clone https://github.com/Mogztter/asciidoctor-reveal.js.git
cd asciidoctor-reveal.js
git checkout node-package
npm install ../asciidoctor-template.js
npm install
cd ../..

echo "## Create files adoc, package"
cat <<- EOF > presentation.adoc
= Title Slide

== Slide One

* Foo
* Bar
* World

== Slide Two

Hello World - Good Bye Cruel World

[NOTE.speaker]
--
Actually things aren't that bad
--
EOF

cat <<- EOF > package.json
{
  "name": "ascii-revealjs",
  "version": "1.0.0",
  "description": "Asciidoctro Revealjs demo",
  "main": "asciidoctor-reveal.js",
  "scripts": {
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "asciidoctor.js": "^1.5.5-2"
  }
}
EOF

cat <<- 'EOF' > reveal-ascii.js
// Load asciidoctor.js + asciidoctor-template.js
var asciidoctor = require('asciidoctor.js')();
var Asciidoctor = asciidoctor.Asciidoctor();
var Opal = asciidoctor.Opal;
Opal.load('nodejs');
Opal.load('pathname');
require('asciidoctor-template.js');

// Convert the document 'presentation.adoc' using Reveal.js backend
var options = Opal.hash({safe: 'safe',
                         template_dir: 'node_modules/asciidoctor-reveal.js/templates',
                         backend: 'revealjs'});
var result = Asciidoctor.$convert_file('presentation.adoc', options);
EOF

echo "## Install node modules"
npm install --safe ./lib/asciidoctor-template.js/
npm install --safe ./lib/asciidoctor-reveal.js/

echo "## Download revealjs"
curl -L https://github.com/hakimel/reveal.js/archive/3.3.0.zip > reveal.js.zip
unzip reveal.js.zip
ln -s reveal.js-3.3.0 reveal.js

echo "## Generate Slideshow"
node reveal-ascii.js

@ggrossetie
Copy link
Member Author

Wow thanks @cmoulliard 😄

@obilodeau I will try to make the requested changes ASAP

@obilodeau
Copy link
Member

Here are the bash instructions that you can use to create and test a node project using Guillaume's modifications.

Thanks! For reference, I needed to do another npm install after the two install --safe otherwise it crashed because I'm missing asciidoctor-js:

$ node reveal-ascii.js
module.js:457
    throw err;
    ^

Error: Cannot find module 'asciidoctor.js'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/olivier/src/asciidoc/presentation-asciidoctorjs-test/reveal-ascii.js:2:44)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

After this the render worked:

$ npm install
[email protected] /home/olivier/src/asciidoc/presentation-asciidoctorjs-test
└── [email protected] 

npm WARN [email protected] No repository field.

$ node reveal-ascii.js
Warning: missing space before text for line 25 of jade file "undefined"
Warning: missing space before text for line 8 of jade file "undefined"
Warning: missing space before text for line 10 of jade file "undefined"
Warning: missing space before text for line 15 of jade file "undefined"
Warning: missing space before text for line 21 of jade file "undefined"
Warning: missing space before text for line 23 of jade file "undefined"
Warning: missing space before text for line 25 of jade file "undefined"
Warning: missing space before text for line 8 of jade file "undefined"
Warning: missing space before text for line 10 of jade file "undefined"
Warning: missing space before text for line 15 of jade file "undefined"
Warning: missing space before text for line 14 of jade file "undefined"
Warning: missing space before text for line 17 of jade file "undefined"

Note that I needed to work around the empty { } bug otherwise reveal.js would crash.

The render is missing a title page and has other problems but those were expected and does not prevent us from merging this.

@obilodeau
Copy link
Member

The bash script should be turned into instructions and added into HACKING.adoc for documentation purposes. Also, I would like to understand what is the purpose of asciidoctor-template.js in a one-liner.

@ggrossetie
Copy link
Member Author

Also, I would like to understand what is the purpose of asciidoctor-template.js in a one-liner.

What do you mean by "in a one-liner" ? Basically, asciidoctor-template.js is a JavaScript implementation of the "official" template converter written in Ruby.
I made some changes mostly to remove Slim/Tilt/Erb specific code and use Jade instead of Slim/Erb as a template engine.

The template converter role is:

  1. scan the template directories to find the template file by name
  2. convert Asciidoctor node using the template found (using Jade as a template engine)

If you are wondering, lib/asciidoctor/core_ext/factory.rb is a monkey-patch of lib/asciidoctor/converter/factory.rb to remove the CompositeConverter (because it's not working yet in a JavaScript environment)

Does that make sense ? 😀 💭

@obilodeau
Copy link
Member

Once the README is fixed up and test setup instructions are written in HACKING.adoc I'll merge this. Thanks!

@obilodeau
Copy link
Member

My package.json was modified during my tests. Here's the diff:

$ git diff
diff --git a/package.json b/package.json
index b109129..294cb0d 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,8 @@
   },
   "homepage": "https://github.com/asciidoctor/asciidoctor-reveal.js",
   "dependencies": {
-    "reveal.js": "3.3.0",
-    "asciidoctor-template.js": "1.5.5-2"
+    "asciidoctor-template.js": "1.5.5-2",
+    "asciidoctor.js": "^1.5.5-2",
+    "reveal.js": "3.3.0"
   }
 }

I don't know if this is expected or not?

@ggrossetie ggrossetie force-pushed the node-package branch 2 times, most recently from 53bccfc to 1de3de2 Compare September 25, 2016 10:59
@ggrossetie
Copy link
Member Author

ggrossetie commented Sep 25, 2016

@obilodeau Done, let me know if this is OK

I've added a section on HACKING.adoc to explain how to setup a test project and how to publish a new version on npmjs.com.

I've also fixed this issue #88 and used revealjsdir in document.jade.

@ggrossetie
Copy link
Member Author

Can somebody resolves the conflicts and apply the PR please ?

Done!

I think this is related to the npm version, not the Node.js version.

Confirmed, this is related to the npm version.
I think we should reintroduce the commande npm i -g npm to update npm version.

I'm currently running version 3.10.8 (with Node.js 0.12) and there's a ton of improvements. I may have to change the default value of revealjsdir because the latest version of npm uses a flat hierarchy and reveal.js is at the root of node_modules .

@obilodeau
Copy link
Member

I think we should reintroduce the commande npm i -g npm to update npm version.

I tend to disagree. Running this as root overwrites files that should be under the authority of my package manager. This makes package integrity verification impossible which I don't accept with from a security standpoint.

var attributes = 'revealjsdir=node_modules/asciidoctor-reveal.js/node_modules/reveal.js';
var options = Opal.hash({safe: 'safe',
backend: 'revealjs',
attributes: attributes});
Copy link
Member

@obilodeau obilodeau Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing attributes as arguments makes overriding them in the document impossible. See the documentation on attribute assignment precedence for more information about that.

I suggest that you push the revealjsdir attribute default value in the example document as I suggested earlier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I don't think that it's a good practice to define "rendering attribute" in the document. revealjsdir only make sense if my backend is revealjs.
My document could be rendered as an HTML5 presentation with Reveal.js or Bespoke.js or even as a PDF...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that a presentation could be targeting several back-end but in 10+ presentations I did in asciidoc there was always something back-end specific. On the other hand, the reveal.js package location issue is real. Yours is not at the same location than mine. What do you propose as a solution to satisfy both location that don't require crippling OS packages? Maybe a check in the javascript shim? I would accept that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add a trailing @ to the value and the attribute can be overridden by the document. Problem solved ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add a trailing @ to the value and the attribute can be overridden by the document.

And I was the one to refer to the documentation... 🤦

I'm opening up a PR with just that.

@obilodeau
Copy link
Member

HACKING and README are too similar and HACKING is actually more complete. I'm merging this and I'll fix the redundancy by moving HACKING's content into README and pushing revealjsdir as a document attribute.

Thanks for the work!

@obilodeau obilodeau merged commit 676ffe7 into asciidoctor:master Sep 28, 2016
obilodeau added a commit that referenced this pull request Sep 28, 2016
* Removed redundancy between HACKING and README doc (DRY principle)
* Respected attribute precedence on :revealjsdir:
@ggrossetie
Copy link
Member Author

HACKING and README are too similar and HACKING is actually more complete. I'm merging this and I'll fix the redundancy by moving HACKING's content into README and pushing revealjsdir as a document attribute.
Thanks for the work!

Ok thanks 😄
Do you have an account on http://npmjs.com/ ? Could you please publish a version ?

@obilodeau
Copy link
Member

Do you have an account on http://npmjs.com/ ?

I don't. Is it easy to take over the maintenance of a package? If so, I would suggest that you publish it under your name since you proposed to be the maintainer of the javascript side of this back-end.

@ggrossetie
Copy link
Member Author

@obilodeau Ok, I don't remember how the "ownership" of a Node package works but I will try 👍

@ggrossetie
Copy link
Member Author

we should definitely get that template converter into the Asciidoctor organization. I've opened up transfer rights. You can either bring in that repository or merge it into asciidoctor.js. It's up to you how you want to manage it.

@mojavelinux Done! https://github.com/asciidoctor/asciidoctor-template.js

@mojavelinux
Copy link
Member

Are you sure about that ? I can't reproduce this behavior. When using both Node 4.2.6 and 0.12.0

I was using Node 4.5, so maybe it was a bug in that version. Either way, I think Node 4 should be avoided since it was the first version after the big merge. I can see still supporting 0.12.0 since a lot of people were stuck on it, but even the last version of Fedora is on Node 6 now.

Regardless, it's just something to be aware if people do report it.

@mojavelinux
Copy link
Member

Confirmed, this is related to the npm version.

Aha. That makes sense.

@mojavelinux
Copy link
Member

I may have to change the default value of revealjsdir because the latest version of npm uses a flat hierarchy and reveal.js is at the root of node_modules .

I think we should simply say "If your node_modules does not have a flat hierarchy, then please update your version of npm. That's an indication that the version of npm on your machine is outdated."

@mojavelinux
Copy link
Member

Done! https://github.com/asciidoctor/asciidoctor-template.js

👍

Permission updated!

@obilodeau
Copy link
Member

Ok found something. Just add me and @mojavelinux as owner on the package
you published with your account. This way we can cover just in case you are
unavailable. What do you think?

https://docs.npmjs.com/cli/owner

If you want to go this way let me know and I'll create an account.

On Wed, Sep 28, 2016, 6:16 PM Guillaume Grossetie [email protected]
wrote:

@obilodeau https://github.com/obilodeau Ok, I don't remember how the
"ownership" of a Node package works but I will try 👍


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#95 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAhWFYQ7ci16_PBhLXQltQtIeRmo2_N3ks5quuaUgaJpZM4J9Jym
.

@mojavelinux
Copy link
Member

👍 That's exactly the arrangement I have on other packages I help maintain. In my opinion, npmjs.com has a better ownership model than other repositories for this reason.

obilodeau added a commit to obilodeau/asciidoctor-reveal.js that referenced this pull request Sep 29, 2016
Related to discussion in asciidoctor#95. Allows our example to avoid :revealjsdir:
document attribute in recent node versions while still allowing
per-document overrides.

Took the opportunity to reverse the default meaning as discussed.
@obilodeau
Copy link
Member

My [new] npmjs.com username is obilodeau.

@ggrossetie
Copy link
Member Author

@obilodeau @mojavelinux Package published! You are both collaborators 🎉
We may need to use Markdown compatible syntax in README.adoc to improve the rendering 😭

@obilodeau
Copy link
Member

Great! Are you planning to do an announcement on discuss.asciidoctor.org? I think downstream would benefit, namely, the AsciidocFX people (@rahmanusta) and adoc-editor (@mgreau) would benefit from this work. And there's the chrome extensions, etc. Getting the word out would help.

We may need to use Markdown compatible syntax in README.adoc to improve the rendering 😭

I googled a bit and didn't find an easy way out... I hoped that we could override the README.adoc with some field in packages.json (something similar can be done in Pypi) but didn't find anything... A really minimal README for the npmjs.com website that points to the github doc would satisfy me. The problem I see is if we put a README.md, it'll override our README.adoc as the default README which I don't want.

@ggrossetie
Copy link
Member Author

Yes I will do an announcement but first I need to fix a major issue in the
Asciidoctor template.js to make it work on browsers.

I also want to improve the documentation and test the integration myself
before go "public".
We are still at an early stage and I don't want users to be disappointed
because this is kinda working.

Le 30 sept. 2016 5:49 AM, "Olivier Bilodeau" [email protected] a
écrit :

Great! Are you planning to do an announcement on discuss.asciidoctor.org?
I think downstream would benefit, namely, the AsciidocFX people (
@rahmanusta https://github.com/rahmanusta) and adoc-editor (@mgreau
https://github.com/mgreau) would benefit from this work. And there's
the chrome extensions, etc. Getting the word out would help.

We may need to use Markdown compatible syntax in README.adoc to improve
the rendering 😭

I googled a bit and didn't find an easy way out... I hoped that we could
override the README.adoc with some field in packages.json (something
similar can be done in Pypi) but didn't find anything... A really minimal
README for the npmjs.com website that points to the github doc would
satisfy me. The problem I see is if we put a README.md, it'll override our
README.adoc as the default README which I don't want.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#95 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAUV3JfZ8_Yk5VkBgPCQQML28nxNDZ4Sks5qvIa6gaJpZM4J9Jym
.

@obilodeau
Copy link
Member

Understood. Please note that I modified the structure of the documentation
in the pull request that turns this back-end into a ruby gem. To make it
consistent with the ruby doc. This is pending a review by @mojavelinux.

We also created a starter repository with bundler instructions. We might
want to do that for node also?

https://github.com/obilodeau/presentation-revealjs-starter

On Fri, Sep 30, 2016, 3:20 AM Guillaume Grossetie [email protected]
wrote:

Yes I will do an announcement but first I need to fix a major issue in the
Asciidoctor template.js to make it work on browsers.

I also want to improve the documentation and test the integration myself
before go "public".
We are still at an early stage and I don't want users to be disappointed
because this is kinda working.

Le 30 sept. 2016 5:49 AM, "Olivier Bilodeau" [email protected] a
écrit :

Great! Are you planning to do an announcement on discuss.asciidoctor.org
?
I think downstream would benefit, namely, the AsciidocFX people (
@rahmanusta https://github.com/rahmanusta) and adoc-editor (@mgreau
https://github.com/mgreau) would benefit from this work. And there's
the chrome extensions, etc. Getting the word out would help.

We may need to use Markdown compatible syntax in README.adoc to improve
the rendering 😭

I googled a bit and didn't find an easy way out... I hoped that we could
override the README.adoc with some field in packages.json (something
similar can be done in Pypi) but didn't find anything... A really minimal
README for the npmjs.com website that points to the github doc would
satisfy me. The problem I see is if we put a README.md, it'll override
our
README.adoc as the default README which I don't want.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#95 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AAUV3JfZ8_Yk5VkBgPCQQML28nxNDZ4Sks5qvIa6gaJpZM4J9Jym

.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#95 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAhWFWl5aRxBotg7EGViGLCINZ0MCIahks5qvLd3gaJpZM4J9Jym
.

@mojavelinux
Copy link
Member

mojavelinux commented Oct 1, 2016

I hoped that we could override the README.adoc with some field in packages.json (something similar can be done in Pypi) but didn't find anything

Yes, that is possible. That's what we do for the bespoke plugins. You can see an example here: https://github.com/opendevise/bespoke-multimedia. What I do is transform the AsciiDoc to Markdown (abbreviated) and add it the readme field in package.json. That's one approach.

The other approach is to use the Markdown compatibility support in Asciidoctor to get a reasonable interpretation of the AsciiDoc. See http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#markdown-compatibility.

Ultimately, we need to get npm to support AsciiDoc. Frankly, it's ridiculous that they don't.

@obilodeau
Copy link
Member

Yes, that is possible. [...] You can see an example here [...]

PR incoming!!

Ultimately, we need to get npm to support AsciiDoc. Frankly, it's ridiculous that they don't.

I filed an issue here: npm/npm#14159. They use this parser for README's: https://www.npmjs.com/package/marky-markdown

I feel like this won't get fixed since it looks like a deep architectural problem (enabling mutliple README processing engine) and npm is clearly winning right now in terms of {mind,market}share. Maybe I'm wrong but the readme field interim is good enough for most projects to at least point to GitHub without having to sacrifice their own markup choice.

That said, I did the right thing ™️ by opening an issue so I feel good about that 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants