Initial implemention of _support/format.sh
This commit is contained in:
parent
f3cef3c398
commit
395803e354
|
@ -0,0 +1,23 @@
|
||||||
|
const prettierMarkdown = require('prettier/parser-markdown')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
parsers: {
|
||||||
|
markdown: {
|
||||||
|
...prettierMarkdown.parsers.markdown,
|
||||||
|
preprocess(text, options) {
|
||||||
|
let result = prettierMarkdown.parsers.markdown.preprocess(text, options)
|
||||||
|
result = convertToCodeFences(result)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertToCodeFences(input) {
|
||||||
|
let source = input
|
||||||
|
source = source.replace(/\n((\n+ [^\n]+)+)/g, (match) => {
|
||||||
|
const dedented = match.replace(/\n /g, '\n').trim()
|
||||||
|
return '\n\n```\n' + dedented + '\n```'
|
||||||
|
})
|
||||||
|
return source
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "@rstacruz/prettier-plugin-markdown-extras",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# https://gist.github.com/olegch/1730673
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
for fn in "$@"; do
|
||||||
|
echo "==> $fn"
|
||||||
|
cat "$fn" \
|
||||||
|
| yarn run -s prettier --stdin-filepath 'file.md' --print-width 60 \
|
||||||
|
| ruby "$DIR/md-postformat.rb" \
|
||||||
|
| tee "$fn" \
|
||||||
|
> /dev/null
|
||||||
|
done
|
|
@ -0,0 +1,7 @@
|
||||||
|
#/usr/bin/env ruby
|
||||||
|
input = $stdin.read
|
||||||
|
|
||||||
|
# Kramdown annotations
|
||||||
|
input = input.gsub(%r{\n\n\{: }, "\n{: ")
|
||||||
|
|
||||||
|
$stdout.write input
|
|
@ -10,7 +10,7 @@ weight: -1
|
||||||
### Keys
|
### Keys
|
||||||
|
|
||||||
| Shortcut | Description |
|
| Shortcut | Description |
|
||||||
| --- | --- |
|
| ------------------- | --------------------------- |
|
||||||
| `Alt ←` _/_ `Alt →` | Move word |
|
| `Alt ←` _/_ `Alt →` | Move word |
|
||||||
| `^U` | Delete to beginning |
|
| `^U` | Delete to beginning |
|
||||||
| `^W` | Delete to previous `/` |
|
| `^W` | Delete to previous `/` |
|
||||||
|
@ -26,9 +26,11 @@ weight: -1
|
||||||
|
|
||||||
### Help
|
### Help
|
||||||
|
|
||||||
| `Alt H` | Help on word (man) |
|
| Shortcut | Description |
|
||||||
| `Alt W` | Help on word (short descriptions) |
|
| -------- | --------------------------------- |
|
||||||
| `Alt L` | List directory on cursor |
|
| `Alt H` | Help on word (man) |
|
||||||
|
| `Alt W` | Help on word (short descriptions) |
|
||||||
|
| `Alt L` | List directory on cursor |
|
||||||
{: .-shortcuts}
|
{: .-shortcuts}
|
||||||
|
|
||||||
## Function
|
## Function
|
||||||
|
@ -122,20 +124,20 @@ complete \
|
||||||
|
|
||||||
### Conditions
|
### Conditions
|
||||||
|
|
||||||
| Condition | Description
|
| Condition | Description |
|
||||||
| --- | ---
|
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `-n __fish_complete_directories STRING DESCRIPTION` | performs path completion on STRING, allowing only directories, and giving them the description DESCRIPTION.
|
| `-n __fish_complete_directories STRING DESCRIPTION` | performs path completion on STRING, allowing only directories, and giving them the description DESCRIPTION. |
|
||||||
| `-n __fish_complete_path STRING DESCRIPTION` | performs path completion on STRING, giving them the description DESCRIPTION.
|
| `-n __fish_complete_path STRING DESCRIPTION` | performs path completion on STRING, giving them the description DESCRIPTION. |
|
||||||
| `-n __fish_complete_groups` | prints a list of all user groups with the groups members as description.
|
| `-n __fish_complete_groups` | prints a list of all user groups with the groups members as description. |
|
||||||
| `-n __fish_complete_pids` | prints a list of all processes IDs with the command name as description.
|
| `-n __fish_complete_pids` | prints a list of all processes IDs with the command name as description. |
|
||||||
| `-n __fish_complete_suffix SUFFIX` | performs file completion allowing only files ending in SUFFIX. The mimetype database is used to find a suitable description.
|
| `-n __fish_complete_suffix SUFFIX` | performs file completion allowing only files ending in SUFFIX. The mimetype database is used to find a suitable description. |
|
||||||
| `-n __fish_complete_users` | prints a list of all users with their full name as description.
|
| `-n __fish_complete_users` | prints a list of all users with their full name as description. |
|
||||||
| `-n __fish_print_filesystems` | prints a list of all known file systems. Currently, this is a static list, and not dependent on what file systems the host operating system actually understands.
|
| `-n __fish_print_filesystems` | prints a list of all known file systems. Currently, this is a static list, and not dependent on what file systems the host operating system actually understands. |
|
||||||
| `-n __fish_print_hostnames` | prints a list of all known hostnames. This functions searches the fstab for nfs servers, ssh for known hosts and checks the /etc/hosts file.
|
| `-n __fish_print_hostnames` | prints a list of all known hostnames. This functions searches the fstab for nfs servers, ssh for known hosts and checks the /etc/hosts file. |
|
||||||
| `-n __fish_print_interfaces` | prints a list of all known network interfaces.
|
| `-n __fish_print_interfaces` | prints a list of all known network interfaces. |
|
||||||
| `-n __fish_print_packages` | prints a list of all installed packages. This function currently handles Debian, rpm and Gentoo packages.
|
| `-n __fish_print_packages` | prints a list of all installed packages. This function currently handles Debian, rpm and Gentoo packages. |
|
||||||
| `-n __fish_use_subcommand` |
|
| `-n __fish_use_subcommand` |
|
||||||
| `-n __fish_seen_subcommand_from init` |
|
| `-n __fish_seen_subcommand_from init` |
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"author": "Rico Sta. Cruz <rstacruz@users.noreply.github.com>",
|
"author": "Rico Sta. Cruz <rstacruz@users.noreply.github.com>",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@rstacruz/prettier-plugin-markdown-extras": "file:_modules/@rstacruz/prettier-plugin-markdown-extras",
|
||||||
"autoprefixer": "^9.8.2",
|
"autoprefixer": "^9.8.2",
|
||||||
"dom101": "^2.2.1",
|
"dom101": "^2.2.1",
|
||||||
"hint.css": "^2.6.0",
|
"hint.css": "^2.6.0",
|
||||||
|
|
|
@ -1170,6 +1170,9 @@
|
||||||
"@parcel/utils" "^1.11.0"
|
"@parcel/utils" "^1.11.0"
|
||||||
physical-cpu-count "^2.0.0"
|
physical-cpu-count "^2.0.0"
|
||||||
|
|
||||||
|
"@rstacruz/prettier-plugin-markdown-extras@file:_modules/@rstacruz/prettier-plugin-markdown-extras":
|
||||||
|
version "1.0.0"
|
||||||
|
|
||||||
"@sinonjs/commons@^1.7.0":
|
"@sinonjs/commons@^1.7.0":
|
||||||
version "1.8.0"
|
version "1.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.0.tgz#c8d68821a854c555bba172f3b06959a0039b236d"
|
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.0.tgz#c8d68821a854c555bba172f3b06959a0039b236d"
|
||||||
|
|
Loading…
Reference in New Issue