Giter VIP home page Giter VIP logo

literate's Introduction

Literate

What is Literate programming?

Literate programming is a style of programming invented by Donald Knuth, where the main idea is that a program's source code is made primarily to be read and understood by other people, and secondarily to be executed by the computer.

This frees the programmer from the structure of a program imposed by the computer and means that the programmer can develop programs in the order of the flow of their thoughts.

A Literate program generally consists of explanation of the code in a natural language such as English, interspersed with snippets of code to be executed. This means that Literate programs are very easy to understand and share, as all the code is well explained.


Literate is a tool for creating literate programs.

The goal of this project is to create a literate programming tool which keeps most, if not all of the features of Knuth and Levy's original CWEB system, but simplifies the system and adds even more features.

You can view the main website about Literate here including a manual on how to use Literate.

Features

  • Supports any language including syntax highlighting and pretty printing in HTML
  • Markdown based -- very easy to read and write Literate source.
  • Reports syntax errors back from the compiler to the right line in the literate source
  • Generates readable and commented code in the target language (the generated code is usable by others)
  • Supports TeX equations with $ notation.
  • Literate source code is readable whether you are looking at the .lit file, or the generated HTML.
  • Highly customizable (you can add your own HTML or CSS)
  • Runs fast -- wc.lit compiled for me in 7ms for both code and HTML output
  • Automatically generates hyperlinks between code sections
  • Formatted output similar to CWEB
  • Supported by micro (by default)
  • Compatible with Vim (literate.vim)

Example

Here is a trivial example of a literate program saved in the file hello.lit.

For a full example of a literate program, please see examples/wc.lit which is a literate implementation of the wc (word count) program found on Unix systems. You can find the compiled html here.

@title Hello world in C

@s Introduction

This is an example hello world C program.
We can define codeblocks with `---`

--- hello.c
@{Includes}

int main() {
    @{Print a string}
    return 0;
}
---

Now we can define the `Includes` codeblock:

--- Includes
#include <stdio.h>
---

Finally, our program needs to print "hello world"

--- Print a string
printf("hello world\n");
---

To compile this code simply run

$ lit hello.lit

Which generates hello.c and hello.html.

You can also find this program in examples/hello.lit.

Installation

Prebuilt binaries

Download
Mac OS X
64 bit Linux
32 bit Linux
Arm Linux

Building from Source

Mac

On Mac you can use brew to build Literate from source:

$ brew tap zyedidia/literate
$ brew install --HEAD literate

For now, Literate is head only.


Literate is made with the D programming language so you must install dmd (D compiler) and dub (D package manager). Then you should download the zip or clone the repository and run the following commands:

$ cd Literate
$ make

You can find the binary in path/to/Literate/bin (you may want to add this to your path or move it to /usr/local/bin).

Editors

Micro

The micro editor has support for literate by default. Download it here.

Vim

You might also want to go install the Vim plugin (it has syntax highlighting of the embedded code, linting with Neomake, and jumping to codeblock definitions). I'm sorry that no other editors are supported -- I don't know how to make plugins for other editors.

Usage

Lit: Literate Programming System

Usage: lit [options] <inputs>

Options:
--help       -h         Show this help text
--tangle     -t         Only compile code files
--weave      -w         Only compile HTML files
--no-output  -no        Do not generate any output files
--out-dir    -odir DIR  Put the generated files in DIR
--compiler   -c         Report compiler errors (needs @compiler to be defined)
--linenums   -l    STR  Write line numbers prepended with STR to the output file
--md-compiler COMPILER  Use COMPILER as the markdown compiler instead of the built-in one
--version    -v         Show the version number and compiler information

For more information see the manual.

Contributing

Literate is written in Literate D and you can find the source code in the lit directory. You can also read the source code compiled by Literate here. I am happy to accept pull requests, and if you find any bugs, please report them. Thanks!

literate's People

Contributors

boriskourt avatar gunnihinn avatar ivanbakel avatar jsyedidia avatar mklca avatar rpendleton avatar xash avatar zyedidia 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  avatar  avatar  avatar  avatar  avatar  avatar

literate's Issues

Weaved documents contain references to missing fonts

When opening a weaved document with the console open, you can observe that the browser attempts to load a font for KaTeX. The weaver seems to be using relative URL's for these fonts, but they aren't anywhere to be found in this repository.

These references should be changed to use the fonts hosted by Cloudflare at https://cdnjs.com/libraries/KaTeX. With that being said, I'm wondering if that's actually the correct solution. The KaTeX CSS loaded from Cloudflare also includes some references to fonts, and there's some overlap between that CSS and the one embedded directly in weaved documents, so perhaps some of this CSS can simply be deleted? (And perhaps the same is true for the scripts?)

I'll likely look into this when I have more time, but figured I would point it out in case someone already knows more about why there's duplication between the embedded and external CSS/JS.

@error_format prevents compilation

I've just tested out this tool.

When invoking lit -c test.lit with the following contents, no compilation occurs.

@code_type cpp .cpp
@Compiler lit test.lit && clang *.cpp
@error_format %s
@comment_type // %s

However, by removing the @error_format line, the above invocation DOES start the compilation process.

Integrate with Jekyll

Hi,

I love your tool. I would like to integrate it into my personal blog. However, I don't know of a good way to do this. I can't really make a blog post because I am unable to include the proper front matter on the generated HTML/MD code. Additionally, Literate generates full HTML instead of just MD.

I suppose I would need two features in order to generate Markdown that could then be processed as a blog post:

  1. Output Markdown file instead of HTML file
  2. Allow the user to prepend a YAML front-matter to the resulting Markdown file

If you think this is an okay idea and have a suggested way to implement such a thing, I would be more than happy to take a crack at it.

Cheers,
Max

Markdown compiler

Hi,

Is the given Markdown compiler run section-by-section? I cannot get footnotes to work properly (using kramdown+GFM) unless I put the footnote body right under the paragraph, and then the footnote appears in the middle of the text. I would expect to be able to define the footnote wherever and have it appear at the bottom in the resulting HTML.

Cheers,
Max

Extra newlines at end of files

I've been using literate together with python, and I've noticed that at the end of the files, literate outputs at least three newlines, when in the original script there isn't a single one specified, is there a reason for this? Or a way for literate to not output this extra newlines?

Line directives without a space, e.g. `#20`

Line directives appear to always insert a space between the prefix given as a command line argument and the actual number. Mercury however requires line directives to be in format #<num> with no space in between. Perhaps support could be added for format strings like "#%d", so that it remains backwards compatible with directives lacking the %d.

Feature request: noTangle block modifier

As a counterpart to the noWeave block modifier it would be quite useful to have a noTangle modifier, for when you want code blocks to appear only in the documentation (e.g. examples, non-compiling code) but not in the actually generated files...

Native "raw" @include

Hi, I'd like to customize the HTML output a bit, using jQuery-UI. I'm trying to add the following to a file:

<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script src="../scripts/jquery-3.1.0.min.js"></script>
<script src="../scripts/jquery-ui-1.12.0/jquery-ui.min.js"></script>

<script>
$( function() {
    $( document ).tooltip();
} );
alert("hola");
</script>

<style>
  label {
    display: inline-block;
    width: 5em;
  }
</style>

but this input is parsed by Literate, generating invalid HTML/JS code:

<p><link rel="stylesheet" href="http://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script src="../scripts/jquery-3.1.0.min.js"></script>
<script src="../scripts/jquery-ui-1.12.0/jquery-ui.min.js"></script>
</p>
<p><script>
<span class="math">( function() {
    </span>( document ).tooltip();
} );
alert("hola");
</script>
</p>
<p><style>
  label {
    display: inline-block;
    width: 5em;
  }
</style>
</p>

As it can be seen, it is adding the inline html into <p> paragraphs, and applying the pretty printer to the content of these paragraphs...

I don't know if this is a bug, regarding this claim in the documentation:

The markdown used by Literate is slightly different than normal markdown: underscores do not do anything, and you can directly inline html. 

But, if not, perhaps a good compromise is to implemenet a @raw-include directive that does not pretty print... or some kind of "verbatim" blocks in the file itself...

Thanks

Proposal: Tufte CSS

What do you think about using this project: Tufte CSS as the base CSS setup? (Their Demo.)

I edited together a super rough view of what it would look like for Literate: on codepen. Just without syntax highlighting.

I can give a stab at adjusting the current HTML and CSS setup.

I think the main pro would be the clean margin notes that can hold some of the metadata that is currently below the code blocks. As well as a refined responsive design and print view.

I've also adapted their setup before for a basic static site generator, so I know my way around the markup (although it is minimal.)

Alternatively I can make an attempt at opening up the way markup is generated by Literate to allow for broader formatting changes?

Infinite Loop with multiple includes

I am having trouble including multiple files. Whenever I have multiple includes it gets into a loop of including the same file over and over, and complaining about redefinition. Each include works independently but not together. I have made the included files super simple to avoid error.

@title My title
  
@s Theory
@include theory.lit
 
@s Code
@include code.lit

Syntax highlighting in HTML output broken for Scheme/Lisp

It's barely detecting anything correctly, as shown below (not even comments). I'd much rather have no syntax highlighting at all than this garbage output (there doesn't appear to be an option for this?). The lang-scheme part is landing in the pre tag correctly, but the prettify code seems to be interpreting it incorrectly. The highlighting in vim is correct (I declared @code_type scheme .scm). I also tried lisp to no effect (except making the vim highlighting slightly worse).

syntax

Whoops, I misspelled 'these' in the screenshot, but I'm not going to go take it again just for that...

Contributing

I am new to D but don't mind looking into helping out with this tool. Do you have any advice on getting started?

Not sure if this is implemented but one of the features from Org/Babel/noweb is indicating whether a block will be included in the weave or not (i.e. for Leaving repetitive code out of the HTML export)

If this isn't implemented I can take a look at getting it in.

links in text

I'm not sure how links are implemented. Thus, book.lit contains this part:

[Hello World](hello.lit)
[Word Count](wc.lit)
[Hangman](hangman.lit)
[Multiple Files](multiple_files.lit)
[Reference](reference.lit)

I would expect the text in the [] to be the text to be shown, and the text in the () to be the linked file. But instead, the text shown comes from the @title of the lit file. That is unexpected. Is this
on purpose?

Would it be possible to document links? Thanks!

Feature request: Preserve diagnostic metadata

The extractor should preserve diagnostic metadata so that stack traces point to the source markdown files instead of the extracted files.

When I run lit and look at the output I see

$ ./bin/lit --out-dir out examples/wc.lit
$ grep -n 'Header files to include' examples/wc.lit
37:@{Header files to include}
48:--- Header files to include
$ head -5 out/wc.c
/* wc.c */
/* Header files to include */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

but I would like head -6 out/wc.c to show something like

/* wc.c */
/* Header files to include */
#line 49 "examples/wc.lit"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

which uses the #line directive to specify the file and line for a section of generated code.

This is C preprocessor specific.
A solution that generalizes to other output languages might require a side-table of line numbers (maybe sourcemap format) that could feed into a language-specific post-processor that

  • produces a JSR 000045 input for Java files
  • fixes byte-code line mappings in .pyc files for python
  • etc.

Feature Request: `run` command

First, thanks for such a good work.
Would you consider adding a 'run' command to Literate, allowing to add the output of said command to the generated .html file?
Something like

@run echo "<br>some markdown or html string<br>"

I'm searching a tool allowing me to describe and test the syntax of my (humble and in devellopment) programming language in a simple manner.

Hope I'm clear.

Can we backport patches from program sources to literate sources?

Suppose we have a program written in Literate, and some collaborators on that program who, for whatever reason, only want to work on the generated program source files. This could happen when working on a literate project in a large company, or when trying to port an existing project into Literate while it still receives patches.

We have ways of pointing compiler errors in the generated sources back to the literate sources. Is it feasible to similarly backport the output of diff on a generated source back to the literate sources?

For example, suppose we have a literate source L from which we generate a program source file S. We modify S and obtain S'. Running diff(S, S') gives us patches P_1, ..., P_n that we can apply to S with patch to obtain S'. Is it possible to "lift" the patches P_j to the literate source L to get patches P'_1, ..., P'_n that give us a literate source L' that generates S'?

In wonky math speak, generating the sources is a function f : L -> S and we have a function patch : S -> S'. Can we always lift it automatically to L -> L' such that the diagram

L --> L'
|     |
v     v
S --> S'

commutes?

If so, contributors or coworkers can remain ignorant of Literate and we can easily benefit from their contributions.

Table support

Might be nice if it also added table support:
pandoc.org/README.html#tables

Pandoc compiler and latex

I've been using the md-compiler branch, in order to be able to include latex equations. The issue I am having is that it looks like '' are removed from equations:

The following doesn't work

$$\frac{1}{2}$$

I can solve it by adding a '' as follows

$$\\frac{1}{2}$$

SIGSEGV on OSX when compiling

When lit is compiling as well as weaving, I get SIGSEGV.
Top of my file is:

@code_type c++ .cpp
@comment_type // %s
@Compiler lit -t main3.lit && g++ -c main3.cpp

It has compile errors. When I run lit -c, I get

'lit -c main3.lit' terminated by signal SIGSEGV (Address boundary error)

I think this is because the compiler outputs lines that lit can not process.
This is in main.lit:

        auto matches = matchFirst(line, r);

        string linenum = matches["linenum"];
        string fname = matches["filename"];
        string message = matches["message"];

I think one needs to first check if matches is empty. For example, if I condition the rest with

if( !matches.empty ) {

I don't get SIGSEGV, lit exits normally. I'm not sure if the best is if or assert.

I thought D won't have these annoying SIGSEGV!

Unintentional equations in markdown

2 $s between backticks in markdown on the same line results in an equation, which isn't really desired between backticks in markdown.

@s Unintentional equation

`$(FOO)` and `$(BAR)` are examples.

Results in:

...
<a name="1:1"><div class="section"><h4>1. Unintentional equation</h4></a>
<p><code>&lt;span class="math"&gt;(FOO)</code> and <code>&lt;/span&gt;(BAR)</code> are examples.
</p>
...

Where the <span/>s have been trapped inside <code/>s & are shown in the rendered HTML page like so:

1. Unintentional equation

<span class="math">(FOO) and </span>(BAR) are examples.

Escaping the use of $ does serve as a workaround, but needing escape sequences inside inline code spans in markdown is counter intuitive and not desired.

Would be ideal if $s inside matched backticks didn't indicate equations. Would also be fine for my use case if there was a way to turn off the equation processing too.

Literate gives out-of-bounds error with certain code_types

With the "Hello World in C" example in the Literate manual, if I add an @code_type declaration for many languages (ex., 'python', 'prolog', 'lisp'), I receive the following trace:

core.exception.RangeError@source/weaver.d(284): Range violation
----------------
??:? _d_arraybounds [0x56dfa3]
??:? weaver.__array [0x561873]
??:? immutable(char)[] weaver.weaveChapter(parser.Chapter, parser.Program, immutable(char)[][immutable(char)[]], immutable(char)[][][immutable(char)[]], immutable(char)[][][immutable(char)[]], immutable(char)[][][immutable(char)[]]) [0x55a8e9]
??:? void weaver.weave(parser.Program) [0x558f6f]
??:? void main.lit(immutable(char)[], immutable(char)[]) [0x50ae91]
??:? _Dmain [0x50c5b4]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x5700b2]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x570008]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x57006e]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x570008]
??:? _d_run_main [0x56ff65]
??:? main [0x50c6fb]
??:? __libc_start_main [0x782a8f44]

This does not happen with an @code_type of c, and indeed the program weaves fine that way.

Parsing compiler output not working

When using the @compiler and @error_format directive, the error output of the used compiler is not parsed.

Build

Build from HEAD (6a9a3af) using ldc2 on MacOS/arm64

Observed Behavior

When running lit -c hello.lit on

@code_type lua .lua
@comment_type -- %s
@compiler lit hello.lit && luacheck --formatter plain hello.lua
@error_format %f:%l:%s: %m

@title Hello World

@s Hello world program

--- hello.lua
local msg = "Hello World"

@{print msg}
---

@s printing

--- print msg
print(msg)
end
---

the output remains

lit hello.lit && luacheck --formatter plain hello.lua
hello.lua:6:1: expected <eof> near 'end'

which is the unparsed output of hte luacheck command.

Expected Behavior

Parsing and translating the filename and line number in the output

lit hello.lit && luacheck --formatter plain hello.lua
hello.lit:20:1: expected <eof> near 'end'

Output markdown instead of HTML

Most opensource projects nowadays have a README in markdown format. It would be great to be able to have Literate generate this README for me.

To achieve this I need Literate to output markdown.

Although I agree that a README should not contain all source code, it would be nice to be able to reference certain code blocks in the README. Usage examples and performing project related tasks.

Also, if Literate outputs markdown, it would play nicer with other tools like pandoc and many other tools that allow markdown as input.

Maybe it's already possible to do this but I haven't been able to get it to work.

Using external markdown compiler fuses words

When using an external markdown program, some words in the resulting html are concatenated, meaning "some word" becomes "someword". I am using cmark as markdown program.

The bug appears if the markdown compiler does not produce a space at the end of a line.

The fix is easy: in weaver.d append a space on every line read. Patch appended.

diff --git a/lit/weaver.lit b/lit/weaver.lit
index 0c8630f..bb058c4 100644
--- a/lit/weaver.lit
+++ b/lit/weaver.lit
@@ -128,7 +128,7 @@ if (useMdCompiler) {
     pipes.stdin.close();
     auto status = wait(pipes.pid);
     string mdCompilerOutput;
-    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup;
+    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup ~ " ";
     if (status != 0) {
         warn(p.file, 1, "Custom markdown compilation failed: " ~ mdCompilerOutput ~ " -- Falling back to built-in markdown compiler");
         html = filterMarkdown(md, MarkdownFlags.disableUnderscoreEmphasis);
@@ -373,7 +373,7 @@ if (useMdCompiler) {
     pipes.stdin.close();
     auto status = wait(pipes.pid);
     string mdCompilerOutput;
-    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup;
+    foreach (line; pipes.stdout.byLine) mdCompilerOutput ~= line.idup ~ " ";
     if (status != 0) {
         warn(c.file, 1, "Custom markdown compilation failed: " ~ mdCompilerOutput ~ " -- Falling back to built-in markdown compiler");
         html = filterMarkdown(md, MarkdownFlags.disableUnderscoreEmphasis);

Syntax highlighting in HTML output broken for OCaml

As seen in the screenshot below, the parser thinks that the bits in between the single quote marks is a string. In fact, this is a polymorphic data structure with type argument 'a.

screen shot 2016-07-02 at 1 57 28 pm

I declared @code_type ocaml ml and also tried caml, sml, etc — but none helped the problem.

Output file sub directories

It would be nice if the output file specification for a code block could include a sub directory which would be created while tangling. It would be handy for languages like Java where the sources have to be in a directory tree.

Example

--- src/main/java/com/acme/Hello.java
CODE
---

Pipe output of code into the html document

It would be great if there was some way of "piping" code output to html. Currently I do this by writing to a file in an assets directory and then including that file.

One simple approach that would already help is to have a way to generate unique filenames, so that you can save to @{uuid 1} in the code and later include @{uuid 1} or a similar approach.

Sections with @s vs headers with #

Is there a reason for @s generating headers exclusively with <h4>? As far as I get from the documentation, the only way to have proper (but unnumbered) subsections is using markdown's # style headers... but I need to use <h5> which may be too small...

As for numbered headers using markdown, one could use --md-compiler 'pandoc --number-section', but still, you require at least one @s in order to render code blocks, and means rendering an <h4>...

I guess I would be happy with either:

  • configurable @s depth, either inline or via cli
  • not requiring @s for rendering code

Thanks for this cool project, hope you don't get tired of my reports ;)

@include misplaces content. [Describing things is hard]

The main file:

@code_type clojure .clj
@comment_type ;; %s

@title Hello Clojure

@s Section

--- example.clj
(ns user)
@{a function}
@{main}

---

@s The meat and potatoes!

--- a function
(defn hello [hi]
(println hi))

---

@s Some other thing!

--- main
(defn -main [& args])

---

@include hello_java.lit

hello_java.lit

@code_type java .java
@comment_type // %s

@title Name

@s Introduction

--- name.java
// Hello World, World.

---

HTML output:

ss_lit

The included hello_java.lit file ends up being between sections Another and Some other thing!, rather than right after Some other thing!.

I tested this by moving the @include statement below each of the sections and it always imports above the section it is below.


Anothing thing I noticed: the 1. Introduction anchor (from the included file) is the same as 1. Section, so it conflicts with linking to section 1.

References to code blocks in normal text are not translated to clickable links

Hello,

I am working with the latest version of Literate. References to code blocks that are contained in other code blocks are translated to clickable links in the html output file. But references that are contained in normal text are written verbatim as plain text.

Example:

@title Test

@s

--- Code Block 1
AAA
---

--- Code Block 2
@{Code Block 1}
---

@{Code Block 1}

According to the manual both cases should work the same way.

Is this a bug?

Best regards,
Manfred

git clone of Literate does not build

I was going to attempt to make a contribution to Literate, but fell at the first hurdle. The mistake could well be mine, of course, but any help appreciated...

$ git clone [email protected]:zyedidia/Literate.git
Cloning into 'Literate'...
Enter passphrase for key '[redacted]':
remote: Enumerating objects: 1979, done.
remote: Total 1979 (delta 0), reused 0 (delta 0), pack-reused 1979
Receiving objects: 100% (1979/1979), 2.09 MiB | 3.51 MiB/s, done.
Resolving deltas: 100% (1323/1323), done.
$ cd Literate/
$ make --debug
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
 File 'release' does not exist.
   File 'lit/markdown/source' does not exist.
  Must remake target 'lit/markdown/source'.
Submodule 'lit/markdown' (https://github.com/zyedidia/dmarkdown) registered for path 'lit/markdown'
Cloning into '/mnt/c/Users/nik/dev/Literate/lit/markdown'...
Submodule path 'lit/markdown': checked out '02b9b68e7f78e83e9f1e2d391263ad57ba988c3f'
  Successfully remade target file 'lit/markdown/source'.
   File 'd-files' does not exist.
     File 'bin/tangle' does not exist.
    Must remake target 'bin/tangle'.
dub --root=lit/tangle build
Performing "debug" build using /usr/bin/dmd for x86_64.
tangle ~master: building configuration "application"...
lit/tangle/src/util.d(55,41): Error: no property canFind for type Modifier[]
lit/tangle/src/util.d(55,89): Error: no property canFind for type Modifier[]
lit/tangle/src/util.d(70,24): Error: no property canFind for type Modifier[]
lit/tangle/src/util.d(78,31): Error: no property canFind for type Modifier[]
/usr/bin/dmd failed with exit code 1.
Makefile:11: recipe for target 'bin/tangle' failed
make: *** [bin/tangle] Error 2
$

Nesting `@book`s?

@zyedidia: Could you make it so that I can nest @books if I can't do so already? What I'd like to do is have a top-level @book-directive file containing the top-level table of contents, then have lit pull in any tables of contents it finds in @book-directive files linked to from this top-level one imported in to that latter one, allowing me to string together nested tables of contents. For example:

In the top-level @book-directive file:

⋮

@s Table of Contents

[Reference to another `@book` directive file relative to this one](link-target)

In the referenced @book-directive file:

⋮

@s Table of Contents

[Reference to another `@book` directive file relative to this one](link-target)

Desired result in top-level @book-directive file:

⋮

# Table of Contents

<!--Top-level ToC entry-->
  <!--Next-level ToC entry pulled in from secondary file-->

Basically, I want to be able to string tables of contents together like that. This might be related to #7, methinks? It might be useful to do something similar with ToCs outside of @book-directive files if those ever exist.

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.