[FIXED] How to compile just the source content? (No document, head, styles, etc.)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[FIXED] How to compile just the source content? (No document, head, styles, etc.)

toastal
This post was updated on .
I've been happier with the feature set of writing AsciiDoc over Markdown and its many limitations. I wanted to use AsciiDoc on SourceHut, but only Markdown is supported out of the box. However, using their GraphQL API, one can POST any arbitrary HTML to the README. SourceHut will do some post-processing--mostly remove some unsupported attributes and turning unsupported elements into <div>s. Where this comes up as in issue is the <style> and <title> elements have content that just gets rendered as plaintext. The `--argument stylesheet!` flag removes the styles but leave me with the <title>. I can't set the doctitle to empty either it seems (and I want to keep the `<h1>`). You can see the issue here and how the title element's contents caused a duplication.

Effectively what I want is *only* the <body> element (but probably in an <article> or no container). I would have expected this is what either `embedded` or `--doctype inline` flags would have meant. This way I could "embed" this markup produced from my AsciiDoc document inside a different, larger HTML-based system.

Unless GitHub and GitLab are using Ruby library to do something the tool doesn't out of the box (which I'm not using Ruby), they must be doing something similar with the CLI tools, but I can't figure it out from the manpages or docs. I also have my next project where I want to do something similar and need just the content to be compatible with a static site build tool, Soupault, but again I just need the content, not a full document. Form what I see though, AsciiDoctor is built to be the end tool and not integrated as a renderer for other tools.
Reply | Threaded
Open this post in threaded view
|

Re: How to compile just the source content? (No document, head, styles, etc.)

abelsromero
I think the `embedded` option from the CLI should provide what you need.
```
-e, --embedded                   suppress enclosing document structure and output an embedded document (default: false)
```

Iirc, it returns the content of the `<div id="content">` element, that is the HTML without header and footer, and css/scripts, etc.
What is that you encounter that does not fit your case?


Reply | Threaded
Open this post in threaded view
|

Re: How to compile just the source content? (No document, head, styles, etc.)

toastal
abelsromero wrote
I think the `embedded` option from the CLI should provide what you need.
```
-e, --embedded                   suppress enclosing document structure and output an embedded document (default: false)
```
Ah, ha. I was using `--argument embedded` which explains why embedded wasn't going anything for me.