WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
This commit is contained in:
+264
@@ -0,0 +1,264 @@
|
||||
#ifndef ANYDOC_H
|
||||
#define ANYDOC_H
|
||||
|
||||
/* Warning: this file is generated by `cargo build -p anydoc-go`. Do not edit by hand. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Success.
|
||||
*/
|
||||
#define ERR_OK 0
|
||||
|
||||
/**
|
||||
* `ConvertError::Unsupported`.
|
||||
*/
|
||||
#define ERR_UNSUPPORTED 1
|
||||
|
||||
/**
|
||||
* `ConvertError::Malformed`.
|
||||
*/
|
||||
#define ERR_MALFORMED 2
|
||||
|
||||
/**
|
||||
* `ConvertError::Encrypted`.
|
||||
*/
|
||||
#define ERR_ENCRYPTED 3
|
||||
|
||||
/**
|
||||
* `ConvertError::ResourceLimit`.
|
||||
*/
|
||||
#define ERR_RESOURCE_LIMIT 4
|
||||
|
||||
/**
|
||||
* `ConvertError::MissingPart`.
|
||||
*/
|
||||
#define ERR_MISSING_PART 5
|
||||
|
||||
/**
|
||||
* `ConvertError::Io`.
|
||||
*/
|
||||
#define ERR_IO 6
|
||||
|
||||
/**
|
||||
* PDF was passed to `anydoc_to_document` (unsupported there).
|
||||
*/
|
||||
#define ERR_PDF_NO_MODEL 7
|
||||
|
||||
/**
|
||||
* Null pointer or invalid argument passed to the ABI.
|
||||
*/
|
||||
#define ERR_INVALID_ARG 8
|
||||
|
||||
/**
|
||||
* Unknown format name passed to the ABI.
|
||||
*/
|
||||
#define ERR_UNKNOWN_FORMAT 9
|
||||
|
||||
/**
|
||||
* C-side format tag. Stable; mirrors the Node/Python lowercase string names
|
||||
* via `format_name`. `ANYDOC_FORMAT_NONE` is the `Option::None` sentinel.
|
||||
*/
|
||||
#define ANYDOC_FORMAT_NONE -1
|
||||
|
||||
#define ANYDOC_FORMAT_DOC 0
|
||||
|
||||
#define ANYDOC_FORMAT_DOCX 1
|
||||
|
||||
#define ANYDOC_FORMAT_ODT 2
|
||||
|
||||
#define ANYDOC_FORMAT_PDF 3
|
||||
|
||||
#define ANYDOC_FORMAT_PPT 4
|
||||
|
||||
#define ANYDOC_FORMAT_PPTX 5
|
||||
|
||||
#define ANYDOC_FORMAT_RTF 6
|
||||
|
||||
#define ANYDOC_FORMAT_EPUB 7
|
||||
|
||||
#define ANYDOC_FORMAT_XLSX 8
|
||||
|
||||
#define ANYDOC_FORMAT_ODS 9
|
||||
|
||||
#define ANYDOC_FORMAT_ODP 10
|
||||
|
||||
#define ANYDOC_FORMAT_CSV 11
|
||||
|
||||
/**
|
||||
* Tag values for `Block` variants. Stable across versions; the Go side maps
|
||||
* these to the same lowercase string names the Node and Python bindings use.
|
||||
*/
|
||||
#define BLOCK_HEADING 0
|
||||
|
||||
#define BLOCK_PARAGRAPH 1
|
||||
|
||||
#define BLOCK_LIST 2
|
||||
|
||||
#define BLOCK_TABLE 3
|
||||
|
||||
#define BLOCK_QUOTE 4
|
||||
|
||||
#define BLOCK_CODE 5
|
||||
|
||||
#define BLOCK_RULE 6
|
||||
|
||||
#define INLINE_TEXT 0
|
||||
|
||||
#define INLINE_LINK 1
|
||||
|
||||
#define INLINE_IMAGE 2
|
||||
|
||||
#define INLINE_ANCHOR 3
|
||||
|
||||
#define INLINE_NOTEREF 4
|
||||
|
||||
#define INLINE_LINEBREAK 5
|
||||
|
||||
#define LINK_EXTERNAL 0
|
||||
|
||||
#define LINK_RELATIVE 1
|
||||
|
||||
#define LINK_ANCHOR 2
|
||||
|
||||
#define IMG_EXTERNAL 0
|
||||
|
||||
#define IMG_ASSET 1
|
||||
|
||||
#define IMG_UNAVAILABLE 2
|
||||
|
||||
#define MARKER_BULLET 0
|
||||
|
||||
#define MARKER_DECIMAL 1
|
||||
|
||||
#define MARKER_LOWER_ALPHA 2
|
||||
|
||||
#define MARKER_UPPER_ALPHA 3
|
||||
|
||||
#define MARKER_LOWER_ROMAN 4
|
||||
|
||||
#define MARKER_UPPER_ROMAN 5
|
||||
|
||||
#define TABLE_DATA 0
|
||||
|
||||
#define TABLE_LAYOUT 1
|
||||
|
||||
#define SLOT_ORIGIN 0
|
||||
|
||||
#define SLOT_COVERED 1
|
||||
|
||||
#define NOTE_FOOTNOTE 0
|
||||
|
||||
#define NOTE_ENDNOTE 1
|
||||
|
||||
/**
|
||||
* Detect the format from the content. Writes a format tag to `*out` (one of
|
||||
* `ANYDOC_FORMAT_*`), or `ANYDOC_FORMAT_NONE` when nothing matches.
|
||||
*
|
||||
* Returns `ERR_OK` on success (including no-match), `ERR_INVALID_ARG` on null
|
||||
* pointers.
|
||||
*/
|
||||
int anydoc_format_from_bytes(const uint8_t *bytes, uintptr_t len, int *out);
|
||||
|
||||
/**
|
||||
* The format a bare extension names (no leading dot). Writes a format tag to
|
||||
* `*out`, or `ANYDOC_FORMAT_NONE` when unrecognized.
|
||||
*/
|
||||
int anydoc_format_from_extension(const char *ext, int *out);
|
||||
|
||||
/**
|
||||
* The format a path's extension names. Writes a format tag to `*out`, or
|
||||
* `ANYDOC_FORMAT_NONE` when unrecognized.
|
||||
*/
|
||||
int anydoc_format_from_path(const char *path, int *out);
|
||||
|
||||
/**
|
||||
* Convert a document file to Markdown. The format is detected from the file
|
||||
* content, with the extension as the fallback for signature-less formats
|
||||
* (CSV).
|
||||
*
|
||||
* On success writes a `*mut c_char` to `*out_str` and its byte length to
|
||||
* `*out_len`. The caller must free the string with `anydoc_string_free`.
|
||||
*/
|
||||
int anydoc_to_markdown(const char *path, char **out_str, uintptr_t *out_len);
|
||||
|
||||
/**
|
||||
* Convert an in-memory document to Markdown. `format_tag` is one of the
|
||||
* `ANYDOC_FORMAT_*` constants, or `ANYDOC_FORMAT_NONE` to detect from the
|
||||
* content.
|
||||
*/
|
||||
int anydoc_to_markdown_bytes(const uint8_t *bytes,
|
||||
uintptr_t len,
|
||||
int format_tag,
|
||||
char **out_str,
|
||||
uintptr_t *out_len);
|
||||
|
||||
/**
|
||||
* Convert an in-memory document to Markdown with embedded images rewritten
|
||||
* as `` so they keep their original positions.
|
||||
*
|
||||
* This is `to_document` + anydoc's official GFM serializer. Asset images are
|
||||
* first turned into `ImageSource::External` URLs; the serializer already
|
||||
* emits those as ordinary Markdown image links. PDF has no document model
|
||||
* and is converted the same way as `anydoc_to_markdown_bytes`.
|
||||
*/
|
||||
int anydoc_to_markdown_with_asset_links(const uint8_t *bytes,
|
||||
uintptr_t len,
|
||||
int format_tag,
|
||||
char **out_str,
|
||||
uintptr_t *out_len);
|
||||
|
||||
/**
|
||||
* Parse an in-memory document into the document model. `format_tag` is one of
|
||||
* the `ANYDOC_FORMAT_*` constants, or `ANYDOC_FORMAT_NONE` to detect from the
|
||||
* content.
|
||||
*
|
||||
* On success writes a heap-allocated byte buffer to `*out_buf` and its length
|
||||
* to `*out_len`. The buffer holds the flat serialization (see `model`). The
|
||||
* caller must free it with `anydoc_buffer_free`.
|
||||
*
|
||||
* Returns `ERR_PDF_NO_MODEL` for PDF input: PDF conversion produces Markdown
|
||||
* directly and has no document-model form. Use `anydoc_to_markdown_bytes`.
|
||||
*/
|
||||
int anydoc_to_document(const uint8_t *bytes,
|
||||
uintptr_t len,
|
||||
int format_tag,
|
||||
uint8_t **out_buf,
|
||||
uintptr_t *out_len);
|
||||
|
||||
/**
|
||||
* Free a string returned by `anydoc_to_markdown*` or `anydoc_last_error`.
|
||||
* Null is a no-op (the empty-string sentinel).
|
||||
*/
|
||||
void anydoc_string_free(char *s);
|
||||
|
||||
/**
|
||||
* Free a document buffer returned by `anydoc_to_document`. Null is a no-op.
|
||||
* `len` must be the length written to `*out_len` at allocation time; it is
|
||||
* validated against the header for safety.
|
||||
*/
|
||||
void anydoc_buffer_free(uint8_t *buf, uintptr_t len);
|
||||
|
||||
/**
|
||||
* Return the human-readable message for the last error on the current
|
||||
* thread. The returned `*mut c_char` is freshly allocated and must be freed
|
||||
* with `anydoc_string_free`. Returns null when there is no last error.
|
||||
*/
|
||||
char *anydoc_last_error(void);
|
||||
|
||||
/**
|
||||
* Return the lowercase name of a format tag, or null for an unknown tag.
|
||||
* The returned string must be freed with `anydoc_string_free`.
|
||||
*/
|
||||
char *anydoc_format_name(int tag);
|
||||
|
||||
/**
|
||||
* Parse a lowercase format name into a tag. Writes the tag to `*out`, or
|
||||
* `ANYDOC_FORMAT_NONE` when the name is unknown.
|
||||
*/
|
||||
int anydoc_format_from_name(const char *name, int *out);
|
||||
|
||||
#endif /* ANYDOC_H */
|
||||
Reference in New Issue
Block a user