https://github.com/rsdoiel/shorthand
A simple text label expander combined with a markdown processor.
https://github.com/rsdoiel/shorthand
label-expander labels macro-language
Last synced: 6 months ago
JSON representation
A simple text label expander combined with a markdown processor.
- Host: GitHub
- URL: https://github.com/rsdoiel/shorthand
- Owner: rsdoiel
- License: agpl-3.0
- Created: 2015-08-29T17:46:47.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T19:47:41.000Z (12 months ago)
- Last Synced: 2025-04-12T09:05:12.943Z (6 months ago)
- Topics: label-expander, labels, macro-language
- Language: Go
- Homepage: http://rsdoiel.github.io/shorthand
- Size: 4.64 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
- Codemeta: codemeta.json
Awesome Lists containing this project
README
[](https://www.repostatus.org/#active)
[](https://snapcraft.io/shorthand)
# shorthand
A simple label or macro expander
Example use cases:
+ label or abbreviation expansion in Markdown files
+ build html templates from markdown files
+ compose pages from multiple markdown files
The supported command line options can be listed using the _--help_
options.
```shell
shorthand --help
```
Source code can be found at [github.com/rsdoiel/shorthand](https://github.com/rsdoiel/shorthand)
The project website is [rsdoiel.github.io/shorthand](http://rsdoiel.github.io/shorthand)
## Tutorial
### Timestamp in Markdown file
If the content of the markdown file _testdata/report.md_ was
```markdown
Report Date: @now
# Topic: The current local time.
This report highlights the current local time of rendering this document
The current local time is @now
```
From the command line you can do something like this
```shell
shorthand -e ':bash: @now date' \
-e ":import: @report testdata/report.md" \
-e "@report" \
-e ':exit:' | pandoc -s > testdata/report.html
```
What this command does is launch the _shorthand_ interpreter and it
replaces all occurrences of "@now" in the markdown document with the
output from the Unix program _date_.
The output (before piping to Pandoc) would look something like
```html
Report Date: Sat Aug 29 11:25:48 PDT 2015
# Topic: The current local time.
This report highlights the current local time of rendering this document
The current local time is Sat Aug 29 11:25:48 PDT 2015
```
Notice that both "@now" are replace with the same date information.
### embedding shorthand definitions
You could also embed the shorthand definitions command straight in the
markdown itself. with something like
```markdown
@now :bash: date
Report Date: @now
# Topic: The current local time.
This report highlights the current local time of rendering this document
The current local time is @now
```
That makes the command line a little shorter
```shell
shorthand testdata/report.md | pandoc -s > testdata/report.html
```
## Installation
_shorthand_ can be installed with the *go get* command.
```
go get github.com/rsdoiel/shorthand/...
```
## Documentation
- [shorthand](shorthand.html)
- [shorthand syntax](shorthand-syntax)