Replies: 9 comments 10 replies
-
For more resources you can follow these sites. Documentation on the Asciidoc Language: https://docs.asciidoctor.org Documentation on the Asciidoc JavaScript library: https://docs.asciidoctor.org/asciidoctor.js/latest/ |
Beta Was this translation helpful? Give feedback.
-
I also set up a repo for you guys to use to play with Asciidoc. All you have to do is fork it then do what ever you need to do with it it's a simple Astro project that uses pnpm as it's package manager, Vitest for test running and it has the |
Beta Was this translation helpful? Give feedback.
-
It's unlikely we'll work on this anytime soon. Feel free to create a community integration for it! |
Beta Was this translation helpful? Give feedback.
-
There's nothing stopping you from creating and publishing an integration yourself. It's unlikely we will have this in core |
Beta Was this translation helpful? Give feedback.
-
Thanks @florian-lefebvre! |
Beta Was this translation helpful? Give feedback.
-
I'm sorry to bring up this discussion again, but I'm banned from the server. @ascorbic . Can you please help me figure out how to watch for file changes. I need to find a way to make sure that asciidoc files and the content collection config is watched for changes so that people don't have to shutdown the server after every change. |
Beta Was this translation helpful? Give feedback.
-
@ascorbic {
name: "",
hooks: {
'astro:config:setup': async (params) => {
addContentEntryType({
extensions: [],
getEntryInfo({ fileUrl, contents }) {
return {
data: {},
body: "",
slug: "",
rawData: {}
}
},
async getRenderModule() {
return { code: "" }
}
});
},
'astro:server:setup': async ({ server }) => {
server.watcher.on('all', (_event, entry) => {
if (SUPPORTED_MARKDOC_CONFIG_FILES.some((f) => entry.endsWith(f))) {
server.restart();
}
});
},
},
} What do First question is do I need the functions? If I do then what am I supposed to return from either functions. I don't plan on manipulating the content myself that is supposed to be done by Asciidoc. @bholmesdev can you help here. |
Beta Was this translation helpful? Give feedback.
-
So I finally figured out what I'm supposed to to with What is |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help @ascorbic. The answer to my problem all along was the watcher. Who ever came up with that idea good job. |
Beta Was this translation helpful? Give feedback.
-
Body
Summary
I want to ask the team to create an official loader for Asciidoc files.
Then integrate other tools for creating Asciidoc files.
Background & Motivation
I recently discovered Asciidoc after watching a YouTube video on it. The video made compelling arguments about why Asciidoc was better than Markdown. I tried it out and I like it. It supports things that most people want without having to download too many things. The problem with Asciidoc is that it isn't supported by any Static Site Generator that I know of.
There are things that the team can provide that I probably won't be able to provide. Like Shiki Support or good configuration.
Goals
Example
The integration of Asciidoc is one that takes on many different APIs, so I decided to split them off into section's. These examples aren't going to be fully concrete. The code written here should be able to help with general idea.
Loader API
The loader API's job is to first use a function to gather a list of paths to an Asciidoc page. Then the paths are then passed on to the asciidoc processor's load function. The
loadFile
function will execute by using each path. Each file's information will be extracted; then sent into the store.The code below is a template. The asciidoc code written is the proper API!
Asciidoc Marcos
Asciidoc can be extended by using the Extensions API. It's an API that allows the developer to tell Asciidoc how to process certain code. A macro is a syntax that is written like this.
element:[]
This is Asciidoc's way or describing elements. There are two kinds of macros. A block and inline macro.The image macro would work like this.
image::img.jpg[alt="Image"]`
The picture macro won't work in Asciidoc. Block macros don't accept blocks as content. But a picture block can be created.
I found out that Asciidoc processor function's can't be used asynchronously at all.
Highlighter
A custom highlighter can be created in Asciidoc by using Asciidoc's Syntax Highlighter class. It's supposed to be done like this.
Using a Config File to Extend Asciidoc
I don't know how to read file system things, so I decided to represent just an object instead. But A config object can be used to register custom blocks and macros. The config object allows its user to
pass in attributes blocks and macros. The
attributes:
property takes an object of curated props that are meant to be added to every page. Theblocks:
prop takes an object that accepts a word as it's key and an object with two properties. Thecontext:
and theprocessor
. The context is the type of block that will be created. The processor is the function that will pass content that needs to be rendered.This is the type for the Asciidoc config.
The code at the bottom is the function for using the config file. The name is
registerBasedOnConfig
It's a function that does the following things.blocks
exists. !f so then it registers blocks by using the properties it contains.macros.inline
exists. If so then it registers inline macros by using its properties,macros.block
exists. If so then registers block macros by using its properties.Asciidoc.Document
I don't know what the config file name should be called, but I think
ascii.config.ts
is a good name.Beta Was this translation helpful? Give feedback.
All reactions