Code Monkey home page Code Monkey logo

asciidoctor-html5s's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciidoctor-html5s's Issues

latexmath should be default

Since we use KaTeX instead of MathJaX, asciimath is not supported anyway. So when user define just :stem:, latexmath should be used.

Should we add a button in the toc component to be able toggle the navigation ?

I'm working on a stylesheet factory that's compatible with a semantic HTML5 output.
One popular request is to be able to create an off-canvas Table Of Contents with a button to toggle it.

I think it will be easier to style the <button> if we put it outside the <nav> ?

<button aria-expanded="false">Table Of Contents</button>
<nav id="navigation">
  <ul>
    <li><a href="#section-1">Section 1</a></li>
    <li><a href="#section-2">Section 2</a></li>
    <li><a href="#section-3">Section 3</a></li>
    <li><a href="#section-4">Section 4</a></li>
  </ul>
</nav>

What do you think ?

Duplicated footnotes in table

Hi, I find this library far much better than the vanilla Asciidoctor for outputting HTML, but it seems there's a little problem.

When you use a recyclable footnote inside table, the original footnote and the copied footnotes always get different numbers.

test.ad:

|===

|cellfootnote:intable[footnote!]

|cellfootnote:intable[]
|===

paragraphfootnote:notintable[footnote?]

another paragraphfootnote:notintable[]
asciidoctor -r asciidoctor-html5s -b html5s test.ad

output via html5s

While,

asciidoctor -b html5 test.ad

output vanilla

remove trailing colon from admonition title-label

I'm learning AsciiDoc and Asciidoctor and I'm in the midst of styling my admonitions. I want to use text rather than an image or icon for each admonition title-label. asciidoctor-html5s automatically puts a colon after the admonition text, e.g.:

NOTE:
a little note

What is a good way to remove the colon (:) after NOTE (and CAUTION, IMPORTANT, TIP, WARNING) if I do not want to recompile this extension? I do not know Ruby and do not have my system set up for Ruby development. Possible solutions might involve:

  • doing something in my CSS to remove the trailing colon
  • editing some file or files on my system that asciidoctor-html5s will pick up when it is run (but I'd rather not have to maintain any such edit on all my devices)

It seems that the colon happens because of line 3 in asciidoctor-html5s/data/templates/admonition.html.slim:

- capture
  h6.block-title class=('label-only' unless title?)
    span.title-label ="#{local_attr :textlabel}: "
    =title
  = html_tag_if !blocks?, :p
    =content
- if admonition_aside?
  aside.admonition-block id=id class=[(attr :name), role] role=admonition_aria
    - yield_capture
- else
  section.admonition-block id=id class=[(attr :name), role] role=admonition_aria
    - yield_capture

Thank you for any tips or suggestions!

Are h6 titles actually desired?

One thing I liked about the about titles from OG AsciiDoc is that titles can be used more like an annotation rather than needing to be a physical <h*> heading. What this means is that it this title does not become a part of the document outline. If I wanted a heading like that I would have used ======. According to the spec, headings like this seem to be a suggestion and not a requirement as there are a lot of sections that don't need this type of outlining header. However, I'm actively willing be told this is a bad assumption about browsers and other readers perceive the document, as well as better understand the HTML spec. To me, it seems like maybe <header> makes more sense without any specified <h*> as it's not a requirement and isn't treated as a part of the outline, but not entirely sure.

Ordered List right after Unordered List combines them

I'm using this package to render my asciidoc files with hugo.

I found that having a ordered list right after a unordered list causes a wrong html-nesting.
The ordered list will be inside the last list item of the unordered list.

The following asciidoc source was used for the test:

sdfhkjdfg


* a
* b
* c





1. a
2. b
.. abc
3. c


sdfhkjdfg

* a
* b
* c


sdfhkjdfg


1. a
2. b
.. abc
3. c

sdfhkjdfg

will result in

<p>sdfhkjdfg</p>
<div class="ulist">
    <ul>
        <li>a</li>
        <li>b</li>
        <li>c
            <ol class="arabic">
                <li>a</li>
                <li>b
                    <ol class="loweralpha" type="a">
                        <li>abc</li>
                    </ol>
                </li>
                <li>c</li>
            </ol>
        </li>
    </ul>
</div>
<p>sdfhkjdfg</p>
<div class="ulist">
    <ul>
        <li>a</li>
        <li>b</li>
        <li>c</li>
    </ul>
</div>
<p>sdfhkjdfg</p>
<div class="olist arabic">
    <ol class="arabic">
        <li>a</li>
        <li>b
            <ol class="loweralpha" type="a">
                <li>abc</li>
            </ol>
        </li>
        <li>c</li>
    </ol>
</div>
<p>sdfhkjdfg</p>

I would expect the following output:

<p>sdfhkjdfg</p>
<div class="ulist">
    <ul>
        <li>a</li>
        <li>b</li>
        <li>c</li>
    </ul>
</div>
<div class="olist arabic">
    <ol class="arabic">
        <li>a</li>
        <li>b
            <ol class="loweralpha" type="a">
                <li>abc</li>
            </ol>
        </li>
        <li>c</li>
    </ol>
</div>
<p>sdfhkjdfg</p>
<div class="ulist">
    <ul>
        <li>a</li>
        <li>b</li>
        <li>c</li>
    </ul>
</div>
<p>sdfhkjdfg</p>
<div class="olist arabic">
    <ol class="arabic">
        <li>a</li>
        <li>b
            <ol class="loweralpha" type="a">
                <li>abc</li>
            </ol>
        </li>
        <li>c</li>
    </ol>
</div>
<p>sdfhkjdfg</p>

examples blocks (====) preceeded by .title are rendered as figures

Hi, another issue about example blocks (i did not check with another block type) when they are preceeded by a .title

====
This is an example
====

is rendered as:

<div class="example-block"><div class="example"><p>This is an example</p></div></div>

but

.my nice example
====
This is an example
====

generates a figure:

<figure class="example-block"><figcaption>Example 1. my nice example</figcaption>
<div class="example"><p>This is an example</p></div></figure>

where i would expect more:

<div class="example-block"><div class="example"><h6 class="block-title">my nice example</h6><p>This is an example</p></div></div>

is there something wrong about titling a block ?

Compatibility with AsciidoctorJS 2.2.x

I did a test run with Asciidoctor 2.2.4 and it works fine for me. At the same time I see that there is a dependency "@asciidoctor/core": ">=2.0.0 <2.2.0".

Would you mind if I try to create a PR to update that dependency to "@asciidoctor/core": ">=2.0.0 <2.3.0"?

Thanks!

Just wanted to say " thank you" for maintaining this repo. It is very useful.

Uninitialized converter using ES6 imports

Using backend with import statements, causes the following output Object freezing is not supported by Opal followed by error:

    uninitialized constant Asciidoctor::Converter
      Converter: uninitialized constant Asciidoctor::Converter

This might be problem with all backends perhaps, first one I am using. Are backends in general usable for in browser usage with asciidoctor.js? I found no manual for backend usage.

Here is the change in my project that introduces the error: smolijar/emily-editor@5a22333

Using callout list raise an exception "undefined method `find_by`"

Callout lists doesn't seem to be working. Example from Asciidoctor doctest.

Document source

[source, ruby]
----
require 'sinatra' // <1>

get '/hi' do  # <2>
  "Hello World!" ;; <3>
end
----
<1> Library import
<2> URL mapping
<3> Content for response

Exception and callstack

/Users/majko/Projects/course-pages/packages/generator/lib/index.js:95
        throw err
        ^
find_by: undefined method `find_by' for nil
    at NilClass_alloc.$$method_missing [as $method_missing] (/Users/majko/Projects/course-pages/node_modules/opal-runtime/src/opal.js:3772:56)
    at NilClass_alloc.method_missing_stub [as $find_by] (/Users/majko/Projects/course-pages/node_modules/opal-runtime/src/opal.js:1202:35)
    at Opal.send (/Users/majko/Projects/course-pages/node_modules/opal-runtime/src/opal.js:1610:19)
    at TMP_25 (/Users/majko/Projects/course-pages/node_modules/asciidoctor.js/dist/node/asciidoctor.js:4227:33)
    at Object.Opal.yield1 (/Users/majko/Projects/course-pages/node_modules/opal-runtime/src/opal.js:1393:14)
    at Array.$$each [as $each] (/Users/majko/Projects/course-pages/node_modules/opal-runtime/src/opal.js:12478:26)
    at Opal.send (/Users/majko/Projects/course-pages/node_modules/opal-runtime/src/opal.js:1610:19)
    at $Section.$$find_by [as $find_by] (/Users/majko/Projects/course-pages/node_modules/asciidoctor.js/dist/node/asciidoctor.js:4222:28)
    at Opal.send (/Users/majko/Projects/course-pages/node_modules/opal-runtime/src/opal.js:1610:19)
    at TMP_25 (/Users/majko/Projects/course-pages/node_modules/asciidoctor.js/dist/node/asciidoctor.js:4227:33)

Table of contents not working with Hugo

I recently started to use this to build my Hugo site with this. As I understand it, Hugo parses the outputted HTML to get the table of contents and excludes it from the HTML. It is extracted to a variable so that themes can make more better use out of it.

After switching to the html5s backend, I noticed the toc is printed on integrate into third-party projectsthe page itself and it seems that Hugo is not able to parse it from the HTML. I suspect Hugo expects to find the toc in some specific type of an element and the way html5s outputs it is not compatible.

Output from stock html5 backend

<div id="toc" class="toc">
  <div id="toctitle">Table of Contents</div>
  <ul class="sectlevel1">
    <li><a href="#_note">Note!</a></li>
    <li><a href="#_support">Support</a></li>
    <li><a href="#_usage">Usage</a></li>
  </ul>
</div>

Output from html5s backend

<nav id="toc" class="toc" role="doc-toc">
  <h2 id="toc-title">Table of Contents</h2>
  <ol class="toc-list level-1">
    <li><a href="#_note">Note!</a></li>
    <li><a href="#_support">Support</a></li>
    <li><a href="#_usage">Usage</a></li>
  </ol>
</nav>

Now, I'm not sure wether this is a Hugo issue or what but I thought I'd start here since one of the goals of the project is to integrate into third-party projects. I'm hoping to find some kind of configuration that allows Hugo to get the toc from the output of html5s.

converter file is missing

lib/asciidoctor/html5s.rb contains a line require 'asciidoctor/html5s/converter' but this file does not exist.

After commenting the line I get: missing converter for backend 'html5s' as the next error.

Dedicated Stylesheets?

Great job! This was something really needed. I see that now it's also available for Asciidoctor Ruby (if I remember correctly, initially it was only supported for the Node version).

I wanted to ask you if there are some CSS stylesheets (or even better, SASS/SCSS project) designed for the HTML output of this backend — e.g. sample documents or books that one could look at for inspiration.

Also, are you planning to create a SASS (or Less, etc.) core library to go with this repository, or even a dedicated "factory template"?

I'm planning to use this extension in an upcoming book publication, so I'll probably be looking into adapting some existing SASS framework to go with it, and I'll be happy to share it when (and if) I manage to (but it won't be anywere soon, though). But of course, any existing examples resources would be a helpful inspiration and starting point in that direction. Having gone through the whole process in the past (for pandoc templates) I know too weel that it can take a good deal of time to create a good stylesheet that covers all the possible elements, layout variants and options (especially if it has to be also mobile and tablet friendly).

Having a customizable SASS framework to go with this project, allowing to produce fully-templated HTML5 docs would be a great milestone, especially if it was an easy to use framework around which different templates-styles could be built. I hope I'll be able to contribute my share in that direction because I use AsciiDoc a lot and I really feel the need for a semantic-HTML alternative like this, and means to customize templates easily.

Fix undefined method `special` in toc

= Title
:toc: macro

Lorem ipsum dolor…

toc::[]

include::path/to/file[]
in `section_level': undefined method `special' for #<Asciidoctor::Block:0x007fb8fb8391c0> (NoMethodError)
in `block in toc'
in `instance_eval'
in `toc'
    def section_level(sec = self)
      (sec.level == 0 && sec.special) ? 1 : sec.level
                             ^---- Problem is here
    end

[question] admonition-block inconsistency: tip & info vs others

TIP and INFO admonition blocks use <aside> as an outmost enclosing element.
The other admonition blocks, CAUTION, IMPORTANT and WARNING, use <section> for the same purpose.

Both use the same CSS class, so this is not an immediate issue.

Is there a reason behind the inconsistency or is it just an oversight?

related to #20

admonition-blocks conversion bug/enhancement

I have the following code as test:

[TIP]
.Info
=====
Go to this URL to learn more about it:

* http://asciidoc.org

Or you could return to the xref:first[] or <<purpose,Purpose>>.
=====

Asciidoctor-pdf renders the same statement as:

Asciidoctor-html5s currently renders it as:

<aside class="admonition-block tip" role="doc-tip">
    <h6 class="block-title">
        <span class="title-label">Tip: </span>
        Info
    </h6>
    <p>Go to this URL to learn more about it:</p>
    <div class="ulist">
        <ul>
            <li><a class="bare" href="http://asciidoc.org">http://asciidoc.org</a></li>
        </ul>
    </div>
    <p>Or you could return to the <a href="#first">First Steps</a> or <a href="#purpose">Purpose</a>.</p>
</aside>

This is impossible to style correctly and the Info is at the wrong place (See stackoverflow).
In general it would be very good to encapsulate the "content" of every admonition in another div in order to be able to style it correctly.

I would expect something like this:

<aside class="admonition-block tip" role="doc-tip">
    <h6 class="block-title">
        <span class="title-label">Tip: </span>
    </h6>
    <div class="block-content"> <!-- or some other class-name -->
        <h6 class="block-title">Info</h6>
        <p>Go to this URL to learn more about it:</p>
        <div class="ulist">
            <ul>
                <li><a class="bare" href="http://asciidoc.org">http://asciidoc.org</a></li>
            </ul>
        </div>
        <p>Or you could return to the <a href="#first">First Steps</a> or <a href="#purpose">Purpose</a>.</p>
    </div>
</aside>

tbody not balanced

Hi and thanks so much for your work.

Just to report my validator htmlhint is not happy that the tbody is not balanced in the tables. (missing )
not sure it really should be in html5… but it is the only error i get :-)

Option to remove extra section or div around lists

I'm quite happy with html5s as it provides very clean an minimal HTML that is easy to integrate with for example a blog.

I found that it adds divs around lists (ol and ul), and sections around every hX. Looking into the source the tags will not be necessary until you use titles for lists, or classes for sections.

I'm currently removing these as post-processing steps to receive a minimal HTML. I wonder if I could provide my own sub-templates that override for example olist.html.slim? I assume removing the extra wrapping HTML elements would not suit everyone else.

I'm using the Node.js version of this library. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.