Sort by - committed date
-
CLI/Template#CLI #Templates ❯ scraps template This command generates the scrap file from the template of the Markdown files under the /templates directory. Step1. Prepare a template First, prepare a template file written in Markdown. The title of the template file will be the template name. The simplest example is a template that generates a daily note for today’s date. The title of the generated scrap can be specified with TOML metadata. +++ title = "{{ now() | date(timezone=timezone) }}" +++ For the features available in the template, please refer to Templates. Sample templates is here. You can check the templates added under /templates with the following command: ❯ scraps template list daily_note Step2. Generate a Scrap from the Template Specify the template name to generate a scrap. If the scrap title is not specified in the template metadata, the title option -t is required when executing the generate command. scraps template generate <TEMPLATE_NAME> -t <SCRAP_TITLE> Example: If metadata is specified in the template ❯ scraps template generate daily_note The metadata will be ignored from the generated scrap.
-
Feature/Templates#Templates The template feature can be used by preparing Markdown files as templates under the templates/ directory, and it is implemented based on Tera, a template engine written in Rust. In templare feature of Scraps, you can mainly use Tera syntax and built-in functions. For more details, please refer to the Tera documentation. Scraps extension In addition to Tera’s syntax and built-ins, custom extensions can be implemented. Here are the custom extensions currently available in Scraps. Variables timezone You can use the timezone specified in Config.toml. {{ timezone }} As an example, use it as the timezone argument in the date filter. {{ now() | date(timezone=timezone) }} Please submit your extension requests to the Issue. Others For samples of templates using Tera, please refer to Sample templates.
-
Sample templates#Templates Daily note Utilizes Tera’s standard now() function, date filter, and Scraps’ custom timezone variable. +++ title = "{{ now() | date(timezone=timezone) }}" +++ Arguments by environment variables Using the get_env() function, you can write templates that customize arguments at the time of CLI execution. +++ title = "[Book] {{ get_env(name="TITLE", default="") }}" +++  }}) When execute generate TITLE="Test-Driven Development By Example" COVER="https://m.media-amazon.com/images/I/71I1GcjT-IL._SY522_.jpg" scraps template generate book
-
Normal link#Markdown Syntax #Internal Link Specifying the name of the markdown file with a notation such as [[Link]] will generate a wiki-like internal link. For example, if you have the following set of files. ❯ tree scraps scraps ├── Overview.md └── Usage.md Fill in the file name in the scraps directory in Overview.md as follows to generate the link. See [[Usage]] for detail.
-
Getting StartedInstallation of Scraps. Init project. Edit the Configuration. Write Markdown files under the /scraps directory: Basic Markdown: CommonMark specification, GitHub-flavored Markdown Extended features: Mermaid, Autolink Linking: Internal Link Build static site files. Serve the site for debugging. Deploy the site, for example using GitHub Pages.
-
Tag link#Internal Link #Markdown Syntax If there is no scrap with the specified title, such as #Markdown Syntax, it becomes a tag. Tags are displayed on the index page. Each tag links to a page that lists all scraps using that tag.
-
Context link#Internal Link #Markdown Syntax In cases where the same term exists in different contexts and Scrap titles would overlap, you can use the context feature by separating them with folders. For example: ❯ tree scraps scraps ├── DDD │ └── Service.md └── Kubernetes └── Service.md Links to Scrap with different contexts can be specified like [[DDD/Service]], [[Kubernetes/Service]]. You can also combine them with Alias link such as [[Kubernetes/Service|Kubernetes Service]]. The context is also displayed on the Scrap detail page in the static site. Not Recommended Scraps aims for simple knowledge management, so overuse of folders should be avoided. Use folders (Context) only in cases such as: When duplicate Scrap titles occur across different contexts When a Scrap has a strong association with a specific context
-
Alias link#Internal Link #Markdown Syntax Internal links allow you to use different display text as aliases. Writing [[Markdown Syntax|here]] creates a link that displays as here but links to the “Markdown Syntax” page.
-
Mermaid#Markdown Syntax By specifying mermaid as the language for a code block, you can use Mermaid diagrams. Example In: ```mermaid graph LR A --- B B-->C[fa:fa-ban forbidden] B-->D(fa:fa-spinner); ``` Out: graph LR A --- B B-->C[fa:fa-ban forbidden] B-->D(fa:fa-spinner);
-
GitHub-flavored Markdown#Markdown Syntax As an extension, GitHub-flavored Markdown is also supported. This includes features such as strikethrough, tables, and task lists. Example Strikethrough In: ~~This text is strikethrough.~~ Out: This text is strikethrough. Task Lists In: - [x] Task 1 - [ ] Task 2 - [ ] Task 3 Out: Task 1 Task 2 Task 3