Coder Social home page Coder Social logo

asciidoctor / asciidoctor-stylesheet-factory Goto Github PK

View Code? Open in Web Editor NEW
176.0 21.0 86.0 1.11 MB

!DEPRECATED! This was the utility project for producing the default stylesheet for the HTML converter in Asciidoctor. The source of the default stylesheet now lives in the main Asciidoctor repository.

License: Other

Ruby 2.58% Shell 3.56% SCSS 93.86%

asciidoctor-stylesheet-factory's Introduction

Asciidoctor stylesheet factory

The purpose of this project is to generate the default stylesheet that gets bundled with Asciidoctor gem. The default stylesheet is configured by the sass/asciidoctor.scss file and the files it includes. Although the project can be used to generate additional themes, those themes are not maintained.

Themes for download

This project does not offer pre-built stylesheet themes you can use with your Asciidoctor projects. And there is no official CDN for Asciidoctor stylesheets.

If you’re looking for additional themes, check out the Asciidoctor Skins project. That project offers numerous pre-built stylesheets based on the default stylesheet that you can download and use locally.

Foundation

The stylesheets in this project are built using Compass, a CSS authoring framework that uses Sass to generate CSS files. The styles and components are generated by Foundation 4, an awesome and flexible CSS component framework that ensures your stylesheet is cross-browser friendly and mobile friendly.

Setup and compilation

To setup the project, make sure you have Ruby, RubyGems and, optionally Node and Bundler. Next, run Bundler to install the required gems:

$ bundle

That command is equivalent to executing:

$ gem install --version '0.12.7' compass
$ gem install --version '4.3.2' zurb-foundation

Then run npm to install the required Node modules:

$ npm i

That command is equivalent to executing:

Once you have the gems and Node modules installed, you can build the stylesheets.

Build the default stylesheet

The main purpose of this repository is to build the default stylesheet. The default stylesheet is generated using the build-stylesheet.sh command.

To run this command, you need the following programs:

  • bundler

  • cssshrink

  • cat

  • sed

  • ruby

Once those are installed, run the command as follows:

$ ./build-stylesheet.sh

This command will create asciidoctor.css and asciidoctor.min.css in the root of this project.

Build the other stylesheets

To build the stylesheets, simply run:

$ compass compile

The stylesheets are compiled from the Sass source files in the sass/ folder and written to the stylesheets/ folder. You can then reference the stylesheets in stylesheets/ from your HTML file.

Create sample documents

First, create a sample AsciiDoc file, such as:

= Introduction to AsciiDoc
Doc Writer <[email protected]>

A preface about http://asciidoc.org[AsciiDoc].

== First Section

* item 1
* item 2

[source,ruby]
puts "Hello, World!"
Tip
Alternatively, you can use this README as an example.

Then, use AsciiDoc or Asciidoctor to generate HTML that uses one of the stylesheets from the stylesheets/ directory:

$ asciidoctor -a stylesheet=./stylesheets/asciidoctor.css sample.adoc

If you want to activate syntax highlighting in the code, add this argument:

-a source-highlighter=highlightjs

Now just browse to sample.html in your browser and checkout the result!

External preview

You may want to preview sample HTML files on another computer or device. To do that, you need to serve them through a web server. You can quickly serve HTML files in the root directory of the project using the following command:

python -m SimpleHTTPServer 4242

Create a new theme

Themes go in the sass/ folder. To create a new theme (e.g., hipster), start by creating two new files:

sass/hipster.scss
  • Imports the theme settings, which includes default variables and resets

  • Imports the AsciiDoc components

  • Defines any explicit customizations

sass/settings/_hipster.scss
  • Sets variables that customize Foundation 4 and the AsciiDoc CSS components

Here’s a minimal version of sass/hipster.scss:

@import "settings/hipster";
@import "components/asciidoc";
@import "components/awesome-icons";
Note
You don’t have to include the underscore prefix when importing files.

You can add any explicit customizations below the import lines.

The variables you can set in sass/settings/_hipster.scss are a combination of the Foundation 4 built-in global settings and global settings and imports for the AsciiDoc components.

Happy theming!

asciidoctor-stylesheet-factory's People

Contributors

bk2204 avatar cmoulliard avatar jaredmorgs avatar leif81 avatar mojavelinux avatar neilccbrown avatar nhr avatar stephenhay avatar youribonnaffe avatar

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciidoctor-stylesheet-factory's Issues

Create a plain.css

I am trying to integrate AsciiDoctor with an existing website but found that without the AsciiDoctor stylesheet some elements are ugly and difficult to style. But using a theme found in this repository changes the styling too much so that the resulting page won't fit the style of the rest of the website.

Could we have a "plain" theme that doesn't change any styling (fonts, h1..h7 styling etc.) but makes AsciiDoc specific elements (e.g. admonitions, attributions in quote blocks etc.) display correctly?

Create a Dark Style

Currently, the style for the white version is really nice, but most editors (like IntelliJ, NetBeans or Atom) all have a dark theme, and the white default style of AsciiDoctor doesn't really match their style.

As an example, take a look at the Atom editor here: https://github.com/asciidoctor/atom-asciidoc-preview
For IntelliJ, I've created a very basic Darcula style, but it would be much easier if this could be supplied out of the box, and be consistent among editors, or at least a good starting point.

tilde doesn't work

this works:

= myheader
:stylesheet: /home/ping/mytest-project/asciidoctor-stylesheet-factory/stylesheets/colony.css

this doesn't:

= myheader
:stylesheet: ~/mytest-project/asciidoctor-stylesheet-factory/stylesheets/colony.css

`$body-font-family` doesn't seem to have an effect

I tried writing a custom stylesheet, but couldn't get $body-font-family or $body-font-style to have any effect on the generated CSS file. $header-font-family seems to work fine though.

I have declared both (body and header settings) in the _settings/mine.scss file after @import "defaults";. Not sure what else I can do. Here are the settings I'm trying:

@import "defaults";
@import url(//fonts.googleapis.com/css?family=Lato);

//$primary-color: #007042;
$body-bg: #DDD;
$body-font-family: freesans, clean, Arial, sans-serif;
$body-font-style: italic;

$header-font-family: 'Lato', Arial, sans-serif;
$header-font-color: #007042;
$subheader-font-color: #7a2518;

$alert-font-color: violet;
$small-font-color: pink;
$anchor-font-color: $header-font-color;

font-family is not resolved correctly

If a new font is added _myStyle.scss and following variables defined,

$font-family: 'Liberation Sans Regular';
$body-font-family: 'Liberation Sans Regular';
$header-font-family: 'Liberation Sans Regular';
$paragraph-font-family: $body-font-family;
$code-font-family: $body-font-family;
$pre-font-family: 'Liberation Sans Regular';

The css file generated does not use this font-family

more myStyle.css | grep font-family
html { font-family: sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ }
code, kbd, pre, samp { font-family: monospace, serif; font-size: 1em; }
button, input, select, textarea { font-family: inherit; /* 1 */ font-size: 100%; /* 2 */ margin: 0; /* 3 */ }
meta.foundation-mq-small { font-family: "only screen and (min-width: 768px)"; width: 768px; }
meta.foundation-mq-medium { font-family: "only screen and (min-width:1280px)"; width: 1280px; }
meta.foundation-mq-large { font-family: "only screen and (min-width:1440px)"; width: 1440px; }
body { background: white; color: #222222; padding: 0; margin: 0; font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-weight: normal; font-style: normal; line-height: 1; position: relative; cursor: auto; }
p { font-family: inherit; font-weight: normal; font-size: 1em; line-height: 1.6; margin-bottom: 1.25em; text-rendering: optimizeLegibility; }
h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6 { font-family: Georgia, "URW Bookman L", Helvetica, Arial, sans-serif; font-weight: normal; font-style: normal; color: #ba3925; text-rendering: optimizeLegibility; margin-top: 1em; margin-bottom: 0.5em; line-height: 1.2125em; }
code { font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; color: #6d180b; }
ul, ol, dl { font-size: 1em; line-height: 1.6; margin-bottom: 1.25em; list-style-position: outside; font-family: inherit; }
pre, pre > code { line-height: 1.4; color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; }
#content #toctitle { font-weight: bold; font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-size: 1em; padding-left: 0.125em; }
.conum { display: inline-block; color: white !important; background-color: #222222; -webkit-border-radius: 100px; border-radius: 100px; text-align: center; width: 20px; height: 20px; font-size: 12px; font-weight: bold; line-height: 20px; font-family: Arial, sans-serif; font-style: normal; position: relative; top: -2px; letter-spacing: -1px; }
@font-face { font-family: "liberation Sans Regular"; src: url('fonts/liberation/Sans-Regular.ttf') format('truetype'), url('fonts/liberation/Sans-Regular.eot') format('embedded-opentype'), url('fonts/liberation/Sans-Regular.svg') format('svg'), url('fonts/liberation/Sans-Regular.woff') format('woff'); }

Do we have to override others variables ?

Produce an embeddable stylesheet

Produce an embeddable stylesheet that can be used where the AsciiDoc is rendered to embeddable HTML. This stylesheet should exclude any of the styling that is needed for the outer framing added by the header_footer option and focus only on styling body content.

Build process fails

I'm getting this output when I run the build-stylesheet.sh script

unchanged sass/riak.scss
unchanged sass/foundation-potion.scss
unchanged sass/maker.scss
unchanged sass/golo.scss
unchanged sass/colony.scss
unchanged sass/iconic.scss
unchanged sass/rocket-panda.scss
unchanged sass/github.scss
unchanged sass/foundation.scss
unchanged sass/rubygems.scss
unchanged sass/foundation-lime.scss
unchanged sass/asciidoctor.scss
unchanged sass/readthedocs.scss
internal/modules/cjs/loader.js:310
      throw err;
      ^

Error: Cannot find module '/home/wyre/asciidoctor-stylesheet-factory/node_modules/csscolormin/index'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:302:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:616:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:879:27)
    at Function.Module._load (internal/modules/cjs/loader.js:785:27)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/wyre/asciidoctor-stylesheet-factory/node_modules/cssshrink/lib/visitors/color-functions.js:1:11)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
    at Module.load (internal/modules/cjs/loader.js:914:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/wyre/asciidoctor-stylesheet-factory/node_modules/csscolormin/package.json',
  requestPath: 'csscolormin'
}

Apparently the csscolormin is not working as expected.

Create an "easy to read theme"

I present to you two images of a site I just read (perhaps you've read it, very good article BTW):

before

and

after

I think two things are key here, one of which I know we've touch upon

  • Larger font
  • smaller content area

I believe most of the sites out there are doing their readers a huge disservice by having huge content areas and smaller fonts. When you see the two images above which looks like it'll be easier and faster to read? If you said the "before" image, you may want to look at teleprompters (http://en.wikipedia.org/wiki/File:Teleprompter_in_use.jpg). So far none of our stylesheets address this need, we should fix it.

Publish or bundle styles so that they can be consumed by tools

Currently, we aren't publishing the styles (at least not in any sort of automated fashion) so that they can be consumed by other tools. We should figure out how to do this so that these themes are available to Asciidoctor users without having to run the stylesheet factory build manually.

Setup a visual QA test suite

For our sanity, we need a visual QA test suite so that we know when a change to the stylesheet definitions, esp the core asciidoc component, causes unanticipated side effects.

I created a very rough list of the stylesheet QA we do while we were prepping the 1.5.0 release, but it needs a lot more work to be anywhere near a complete list.

https://github.com/asciidoctor/asciidoctor/wiki/Release-Checklist#stylesheet-qa

We're mostly looking at A/B testing here...so we'd need to establish a baseline, then we can get a report whether the change broke anything unexpected. I'm thinking CasperJS is the solution here (see http://casperjs.org/)

Install-instructions requires too much prior knowledge

Hi!

I've never done anything with ruby before, so I don't know the all the "isms".

I think I managed to suss out, what it was I was supposed to have installed, but several of the commands in the install-instructions makes no sense to me. Ie. How can I just execute "bundle" and then expect it to know what I mean? Well, it turns out that it does not. could not locate Gemfile

An instruction like this: "To setup the project, make sure you have Ruby, RubyGems and, optionally Node and Bundler. Next, run Bundler to install the required gems:" is just plain confusing - ok, an optional prerequisite?!

Using the alternate commands works a little better, but ... the whole thing ends with: run ./build-stylesheet.sh - Well, as far as I can tell, I've managed to install everything (even Bundle), but for the life of me: There is no build-stylesheet.sh file on my harddisk at all, and how did the author know what my current pwd would be?

Are the another set of instructions somewhere?

Create RedHat Style

Create RedHat Style to display text using font Liberation Sans.

  • Font can be rendered by the browser using css3 @font-face,
  • Font files (eot, svg, ttf, woff) should be converted in base64 to be embedded in the html generated
  • Compass supports font-face
@include font-face("liberation Sans Regular", inline-font-files("liberation/Sans-Regular.ttf", "liberation/Sans-Regular.eot", "liberation/Sans-Regular.svg","liberation/Sans-Regular.woff"));

summary element not rendered properly on FireFox

I was instructed here by @Mogztter to open a new issue here. I will just quote him:

It's a style issue on Firefox (not related to this extension).
Asciidoctor default stylesheet is using Foundation 4.3.2 and Foundation is using Normalize 2.1.2 which wrongly uses a display: block on summary element. The correct display should be display: list-item.
This issue is already fixed in the latest normalize release: https://github.com/necolas/normalize.css/blob/master/normalize.css#L329

basically I want to have collapsible sections as demonstrated here. However the black arrow next to the collapsible link is not shown:

hlDKvRJQwv

it should be like:

r3cO5RcGaT

surprisingly on Atom I have the exact opposite issue. The arrow is rendered but the collapsible part is not collapsible :)

PGMRHtNYUx

Upgrade to Fontawesome 4.x

As Asciidoctor 1.5 supports Font Awesome Icons, we should also update the stylesheet factory to reflect this capability & moves to Font Awesome 4.x

BTW, we should perhaps create a tag for the code which is linked by asciidoctor 1.0.4 or 1.5 ?

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.