GithubHelp home page GithubHelp logo

lmt's People

Contributors

bmallred avatar driusan avatar enderger avatar mek-apelsin 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

lmt's Issues

Feature request: Keep indentation from macros references

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):

"code"

print(i)

The result should then be:

for (i in 1:5)
    print(i)

Thank you for this package, it's awesome!

Windows line endings not working

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.

Incompatible with `pandoc`?

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 looks awesome, but how do I use it?

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:

  • Couldn't figure out how to make go get do anything
  • so I read the go help build output
  • I checked out the project and did go build -o ~/bin/lmt, which left an executable in ~/bin. Great.
  • lmt --help seemed to be trying to open --help as a file
  • So I made a simple test file (test.txt)
  • But then lmt test.txt had no effect.
  • Removed main.go and 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.
  • Eventually figured out it doesn't support ​```c++ blocks
  • After lots of trial and error, figured out that you need to lmt README.md WhitespacePreservation.md SubdirectoryFiles.md LineNumbers.md, in that order, to reproduce main.go

Consider making += the default

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.”

indented code blocks don't tangle

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)

  1. item 1 is like this

    first line
  2. item 2

    first line

(lmt output)
No files generated.

Can't tangle subpath

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.

Feature: Add a directive system

Adding directives

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.

Syntax

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

Suggested Directives

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).

tangle without compiler directives?

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?

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.