Code Monkey home page Code Monkey logo

org-spec's Introduction

thi.ng/org-spec

An Org-mode template for technical specification documents and HTML publishing

Features

  • Specification document skeleton for a web application, incl. usage examples of various org-mode features:
    • Inline, text-based diagramming via Ditaa, Graphviz & PlantUML
    • Hyperlink abbreviations (incl. presets for GitHub, RFC, W3C, Wikipedia)
    • Section status flags, tags & custom properties
    • Tables
    • Named section IDs for internal x-refs
    • Footnotes
    • Automatically updating fields (e.g. publication date)
    • Automatic updating of document changelog (using git commits)
  • Beautiful, minimal, responsive CSS theme with print support (also for PDF generation)
  • Basic syntax highlighting of code blocks

Example output

Take a look at the published version of the included demo document:

http://demo.thi.ng/org-spec/

The corrensponding .org source file: https://raw.githubusercontent.com/thi-ng/org-spec/master/index.org

Getting started

The index.org source file contains everything (apart from CSS, which is located in the /css dir), including build instructions and further comments, not visible in the exported document.

You can use s3cmd to quickly publish the generated HTML version to AWS S3, like so:

# if you need to install s3cmd first
brew install s3cmd
s3cmd --configure

# optionally create a website bucket
s3cmd ws-create s3://BUCKETNAME

# only upload HTML, CSS & PNGs
s3cmd -P --recursive --exclude=* \
      --include=index.html \
      --include=*.css \
      --include=assets/*.png \
      put . s3://BUCKETNAME

Diagramming & exporting

The template heavily utilizes Org-mode’s noweb references to assemble diagrams from individual snippets, as well as to provide CSS-like functionality for diagrams by defining a single snippet (per diagram tool) containing global styles.

The code blocks actually defining the full diagrams are all located in the last section of the document (titled “Diagram definitions”). This section is only present in the source code and will NOT be exported to HTML (however the code blocks are still evaluated during export and hence produce the diagrams each time).

If your doc contains a lot of such diagrams (especially PlantUML), then exporting can take quite a long while. To save time (and if you’re not currently working on diagram parts), you can temporarily disable the evaluation of ALL code blocks by setting the org-export-babel-evaluate to nil:

(setq org-export-babel-evaluate nil)

;; to re-enable...
(setq org-export-babel-evaluate t)

Custom property export

By default the template is configured to export only a specific set of properties stored in drawers attached to a section/sub-tree. The list of exported property names can be edited in line 4 of the template:

#+OPTIONS: prop:("VERSION")

To enable all properties:

#+OPTIONS: prop:t

License

MIT License, (c) 2016 Karsten Schmidt

org-spec's People

Contributors

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

org-spec's Issues

#postamble has to be styled

I see that you are doing this:

#+HTML: <div class="outline-2" id="meta">
| *Author* | {{{author}}} ({{{email}}})    |
| *Date*   | {{{time(%Y-%m-%d %H:%M:%S)}}} |
#+HTML: </div>

However, orgmode already outputs this information in postamble. Right now it is rendered underneath the ToC, which is definitely not right.

Replace CSS with SASS

Add variables for:

  • link colors
  • notice box colors
  • syntax classes
  • code bg
  • fonts (headers, body, code)
  • print opts (e.g. page breaks for h2 / h3...)

Do not use 100% width for tables

Otherwise tables look too wide.

Compare this:

screenshot, wide table

With this:

screenshot, narrow table

It looks better, except that JS label is on top of the text. Perhaps fix it with a little bit of right padding?

Tests needed

Right now I am afraid to submit pull requests because I don't want to break something.

Would be cool if there was a set of test cases, so that I can open both versions (old and new) side by side and see if everything looks correctly.

One way to do it so to create test-like .org files for each expected feature. Another is to expand files in sections/ folder so that every possible feature (or edge case) is there. I'd much rather prefer the former (each test in a separate file).

Not sure if there is any way to automate it. Perhaps create an image for every test with wkhtmltoimage, compose them side by side and save into a folder? I have no idea how CSS projects are usually tested.

Table of contents should have no vertical padding

Actually, I am not sure about this one.

But try this:

  • Create a document with many headings
  • Change height of your window slightly, so that some part of the ToC is cut off (does not fit into the window vertically)
  • Scrollbar should appear
  • If you scroll down, can you see the last ToC item?

I can't, but I already have a lot of modifications to the style, so perhaps my bug report is not valid. Try it yourself.

I did this to fix it:

@media screen {
    #table-of-contents {
        padding: 0 0 0 2em; /* was 2em 0 2em 2em */
    }
    #table-of-contents h2 {
        margin-top: 1.5em; /* was 0 */
    }
}

Export one or more word docx

It would be great to be able to make versioned word documents (e.g. generated with pandoc).

Others can then make changes (using change highlighting) that i can then use to update the source.

pre background is laggy

pre elements are styled like this:

pre {
    background-color: #f8f8f8;
    background-size: 8px 8px;
    background-image: linear-gradient(135deg, transparent 25%, rgba(0, 0, 0, 0.02) 25%, rgba(0, 0, 0, 0.02) 50%, transparent 50%, transparent 75%, rgba(0, 0, 0, 0.02) 75%, rgba(0, 0, 0, 0.02));
}

This may not be noticeable on faster machines, but this kind of background lags way too much on some computers. Perhaps it also depends on the browser (I am using firefox), but I recommend to just throw it away.

This zebra-like background makes code hard to read anyway, plain gray background is probably better.

Macros for RFC2119

RFC2119 keywords can be macros, allowing programmatic handling of these elements, summary tables, etc. For example:

#+MACRO: MUST <something>
#+MACRO: SHOULD <something>

The document {{{MUST(support RFC2119)}}} and {{{SHOULD(have neat feature)}}}

where <something> can be an inline code block, which both prints the string so it is included in the Org source and exported, but also appends the string to a file that could be included elsewhere as a table in the Appendix that aggregates and references all of the MUST and SHOULD clauses.

font markup in tables

This is a superb theme. Yet I noticed that the verbatim or code markup of fonts in tables does not work: This table

  | =verbatim= | text      |
  | ~code~     | more text |

does not display properly, while this inline markup is fine: =verbatim= and ~code~.

It seem as if the css file needs to be modified to the effect that td code is deleted from the line

h2 code, h3 code, h4 code, h5 code, td code{
    font-family: inherit !important;
    font-size: inherit !important;
}

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.