luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
265 stars 19 forks source link

Convert rails documentation does not work #70

Open fishman opened 8 months ago

fishman commented 8 months ago
vim-devdocs] Converting guides/active_storage_overview (181/745)
[nvim-devdocs] Failed to convert "guides/active_storage_overview", please report this issue

...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:150: attempt to index local 'line' (a nil value)
stack traceback:
^I...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:150: in function 'get_text_range'
^I...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:166: in function 'get_node_text'
^I...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:267: in function 'eval'
^I...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:251: in function 'fn'
^I/usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree'
^I/usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:349: in function 'for_each_tree'
^I...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:246: in function <...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/
transpiler.lua:245>
^I[C]: in function 'xpcall'
^I.../share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/build.lua:47: in function 'build_docs'
^I...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/operations.lua:73: in function ''
^Ivim/_editor.lua: in function <vim/_editor.lua:0>

Original html document:

<h1>Active Storage Overview</h1>
<div class="_simple"> <p>This guide covers how to attach files to your Active Record models.</p>
<p>After reading this guide, you will know:</p> <ul> <li>How to attach one or many files to a record.</li> <li>How to delete
an attached file.</li> <li>How to link to an attached file.</li> <li>How to use variants to transform images.</li> <li>How to
 generate an image representation of a non-image file, such as a PDF or a video.</li> <li>How to send file uploads directly f
rom browsers to a storage service, bypassing your application servers.</li> <li>How to clean up files stored during testing.<
/li> <li>How to implement support for additional storage services.</li> </ul>  <h2 class="chapter">Chapters</h2> <ol class="c
luckasRanarison commented 8 months ago

What version of rails docs did you install? I've tried the 7.0 and 6.1 one and both work correctly. It looks similar to #58. Could you give me more information, OS, neovim, nvim-treesitter and curl version.

ttitoo commented 7 months ago

Rails 6.1 can be installed successfully, but no luck with 7.0 and 7.1 image

By the way, great plugin!

jweslley commented 7 months ago

I got the same outcome as @ttitoo . This plugin is awesome 🚀🚀🚀

My setup is: OS: MacOS Sonoma 14.2.1 (23C71) neovim: v0.9.5 nvim-treesitter: commit=10d79b5dbbdffc3edf307b189284fb62e2e79a3e curl: v8.4.0

natematykiewicz commented 7 months ago

Same. I was able to install ruby-3.3, html, css, typescript, and taildwindcss just fine. But rails-7.0 and rails-7.1 both give me this:

[nvim-devdocs] Failed to convert "guides/action_cable_overview", please report this issue

...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:150: attempt to index local 'line' (a nil value)
stack traceback:
    ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:150: in function 'get_text_range'
    ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:166: in function 'get_node_text'
    ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:267: in function 'eval'
    ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:251: in function 'fn'
    ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree'
    ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:349: in function 'for_each_tree'
    ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:246: in function <...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/transpiler.lua:245>
    [C]: in function 'xpcall'
    .../share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/build.lua:47: in function 'build_docs'
    ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/operations.lua:73: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

Original html document:

<h1>Action Cable Overview</h1>
<div class="_simple"> <p>In this guide, you will learn how Action Cable works and how to use WebSockets to incorporate real-time features into your Rails application.</p>
<p>After reading this guide, you will know:</p> <ul> <li>What Action Cable is and its integration backend and frontend</li> <li>How to set up Action Cable</li> <li>How to set up channels</li> <li>Deployment and Architecture setup for running Action Cable</li> </ul>  <h2 class="chapter">Chapters</h2> <ol class="chapters"> <li><a href="#what-is-action-cable-questionmark">What is Action Cable?</a></li> <li> <a href="#terminology">Terminology</a> <ul> <li><a href="#terminology-connections">Connections</a></li> <li><a href="#consumers">Consumers</a></li> <li><a href="#terminology-channels">Channels</a></li> <li><a href="#subscribers">Subscribers</a></li> <li><a href="#pub-sub">Pub/Sub</a></li> <li><a href="#terminology-broadcastings">Broadcastings</a></li> </ul> </li> <li> <a href="#server-side-components">Server-Side Components</a> <ul> <li><a href="#server-side-components-connections">Connections</a></li> <li><a href="#server-side-components-channels">Channels</a></li> </ul> </li> <li> <a href="#client-side-components">Client-Side Components</a> <ul> <li><a href="#connections">Connections</a></li> </ul> </li> <li> <a href="#client-server-interactions">Client-Server Interactions</a> <ul> <li><a href="#streams">Streams</a></li> <li><a href="#client-server-interactions-broadcastings">Broadcastings</a></li> <li><a href="#client-server-interactions-subscriptions">Subscriptions</a></li> <li><a href="#passing-parameters-to-channels">Passing Parameters to Channels</a></li> <li><a href="#rebroadcasting-a-message">Rebroadcasting a Message</a></li> </ul> </li> <li> <a href="#full-stack-examples">Full-Stack Examples</a> <ul> <li><a href="#example-1-user-appearances">Example 1: User Appearances</a></li> <li><a href="#example-2-receiving-new-web-notifications">Example 2: Receiving New Web Notifications</a></li> <li><a href="#more-complete-examples">More Complete Examples</a></li> </ul> </li> <li> <a href="#configuration">Configuration</a> <ul> <li><a href="#subscription-adapter">Subscription Adapter</a></li> <li><a href="#allowed-request-origins">Allowed Request Origins</a></li> <li><a href="#consumer-configuration">Consumer Configuration</a></li> <li><a href="#worker-pool-configuration">Worker Pool Configuration</a></li> <li><a href="#client-side-logging">Client-side logging</a></li> <li><a href="#other-configurations">Other Configurations</a></li> </ul> </li> <li> <a href="#running-standalone-cable-servers">Running Standalone Cable Servers</a> <ul> <li><a href="#in-app">In App</a></li> <li><a href="#standalone">Standalone</a></li> <li><a href="#notes">Notes</a></li> </ul> </li> <li><a href="#dependencies">Dependencies</a></li> <li><a href="#deployment">Deployment</a></li> <li><a href="#testing">Testing</a></li> </ol>   <h2 id="what-is-action-cable-questionmark"><a class="anchorlink" href="#what-is-action-cable-questionmark">1 What is Action Cable?</a></h2>
<p>Action Cable seamlessly integrates <a href="https://en.wikipedia.org/wiki/WebSocket">WebSockets</a> with the rest of your Rails application. It allows for real-time features to be written in Ruby in the same style and form as the rest of your Rails application, while still being performant and scalable. It's a full-stack offering that provides both a client-side JavaScript framework and a server-side Ruby framework. You have access to your entire domain model written with Active Record or your ORM of choice.</p>
<h2 id="terminology"><a class="anchorlink" href="#terminology">2 Terminology</a></h2>
<p>Action Cable uses WebSockets instead of the HTTP request-response protocol. Both Action Cable and WebSockets introduce some less familiar terminology:</p>
<h3 id="terminology-connections"><a class="anchorlink" href="#terminology-connections">2.1 Connections</a></h3>
<p><em>Connections</em> form the foundation of the client-server relationship. A single Action Cable server can handle multiple connection instances. It has one connection instance per WebSocket connection. A single user may have multiple WebSockets open to your application if they use multiple browser tabs or devices.</p>
<h3 id="consumers"><a class="anchorlink" href="#consumers">2.2 Consumers</a></h3>
<p>The client of a WebSocket connection is called the <em>consumer</em>. In Action Cable, the consumer is created by the client-side JavaScript framework.</p>
<h3 id="terminology-channels"><a class="anchorlink" href="#terminology-channels">2.3 Channels</a></h3>
<p>Each consumer can, in turn, subscribe to multiple <em>channels</em>. Each channel encapsulates a logical unit of work, similar to what a controller does in a typical MVC setup. For example, you could have a <code>ChatChannel</code> and an <code>AppearancesChannel</code>, and a consumer could be subscribed to either or both of these channels. At the very least, a consumer should be subscribed to one channel.</p>
<h3 id="subscribers"><a class="anchorlink" href="#subscribers">2.4 Subscribers</a></h3>
<p>When the consumer is subscribed to a channel, they act as a <em>subscriber</em>. The connection between the subscriber and the channel is, surprise-surprise, called a subscription. A consumer can act as a subscriber to a given channel any number of times. For example, a consumer could subscribe to multiple chat rooms at the same time. (And remember that a physical user may have multiple consumers, one per tab/device open to your connection).</p>
<h3 id="pub-sub"><a class="anchorlink" href="#pub-sub">2.5 Pub/Sub</a></h3>
<p><a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern">Pub/Sub</a> or Publish-Subscribe refers to a message queue paradigm

I do also see that rails-6.1 installs fine. Seems like something is wrong with the HTML.

The error message shows that this file has no single root node. It's just a bunch of siblings because it gets included into a larger HTML file on api.rubyonrails.org. Perhaps this is the issue?