driusan / lmt Goto Github PK
View Code? Open in Web Editor NEWliterate markdown tangle
License: MIT License
literate markdown tangle
License: MIT License
Would it be possible to keep indentation upon tangle based on the indentation of the macro in the code block containing it (similarly to what noweb
does)?
For example, in the following code block there is the macro code
to be expanded, which is indented (4 spaces):
for (i in 1:5)
<<<code>>>
and the content of the macro is the following (no indentation):
print(i)
The result should then be:
for (i in 1:5)
print(i)
Thank you for this package, it's awesome!
After testing a file in github discussions #22, lmt seems to fail with Windows style \r\n
line endings. I haven't had a chance to dig into why, but there's likely a regex somewhere that needs to be updated to support Windows.
The latest commit 460b02b moves the file name and the chunk name specifications after the opening three backticks. Unfortunately this seems not to be compatible with pandoc
markdown, while of course it is with GitHub markdown.
This means that if we want to compile documentation using pandoc
to convert from an .md
file to, say, a .pdf
(rather than using a GitHub markdown compatible renderer), the resulting file does not correctly creates chunks because the lmt
file names and chunk names interfere (I even tried converting from GitHub flavoured markdown to Pandoc's markdown but it does not work).
This project looks extremely promising to me; I'm so excited!
But I'm not fluent in the idioms of go, so it's not obvious how to build, install, and invoke it. Just a little help in the readme for users of other languages would make a big difference.
Here's my intro experience:
go get
do anythinggo help build
outputgo build -o ~/bin/lmt
, which left an executable in ~/bin. Great.lmt --help
seemed to be trying to open --help
as a filelmt test.txt
had no effect.lmt *.md
in the source dir to make sure it worked; it seemed to, but it generated different contents for main.go, which didn't actually compile.```c++
blockslmt README.md WhitespacePreservation.md SubdirectoryFiles.md LineNumbers.md
, in that order, to reproduce main.go
Given that clobbering the existing macro or file is rather a special case, it might be good to swap things around and make appending be the default. I'd suggest !
for “clobber.”
Recently, I’ve taken the liberty of packaging this tool for the Nix User Repositories. Would you add instructions for installing it from there?
nix-env -iA nur.repos.hutzdog.lmt
If the file name contains a dash, like foo-test.R
, the output file is called foo
.
Tangling doesn't happen on a code block that is indented, e.g. into a list:
(source)
1. item 1 is like this
```txt stuff.txt
first line
```
2. item 2
```txt stuff.txt +=
first line
```
(rendered)
item 1 is like this
first line
item 2
first line
(lmt output)
No files generated.
Assuming a folder ~/literate
and a file ~/literate/conf.md
, this works:
cd ~
cd literate
lmt conf.md
but this doesn't
cd ~
lmt literate/conf.md
The command runs without any warnings or errors, but the tangled source code file doesn't get created/changes.
Currently, LMT provides a great way to weave code from most flavors of Markdown. However, the lack of a directive system makes it dificult to provide flexibility. I propose a system of directives, which can be used for slight alterations of the program's behavior.
I propose that directives take the following syntax, which retains compatibility with most forms of Markdown:
<!--@<name> <paramaters>-->
This syntax uses HTML comments to hide these directives in the output, while still remaining distinct from other comments
A few directives sorely missing are:
@namespace <name>
, which causes everything up to the next namespace directive to be handled separately. This provides a concrete mechanism for avoiding accidentally overwriting code blocks.@defaultAppend <bool>
, which determines whether to append by default (see #14).@requireUndefined <name>
, which requires that a macro is not defined outside of this file (again, preventing collisions).I wrote a literate program blog post implementing a quicksort, and the first draft tangled, but this final draft did not tangle: index.md
I went through the README and the Implementation in this repo, and couldn't find anything wrong with the syntax. Am I doing this wrong or is this a bug?
I tried using lmt
for documenting some shell scripts, but the generated files are splatted with what I assume are some sort of go
compiler directives, like this:
%!(EXTRA int=87, main.File=2019-12-19-ovn-and-dhcp.lmt.md)#!/bin/sh
set -e
%!(EXTRA int=75, main.File=2019-12-19-ovn-and-dhcp.lmt.md)systemctl enable --now openvswitch ovn-controller
%!(EXTRA int=83, main.File=2019-12-19-ovn-and-dhcp.lmt.md)ovs-vsctl add-br br-int
What what I wanted was:
#!/bin/sh
set -e
systemctl enable --now openvswitch ovn-controller
ovs-vsctl add-br br-int
Is there any way to turn this off?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.