file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
src/util/location.rs | Rust | //! Deal with positions in a file.
//!
//! * Convert between byte indices and unist points.
//! * Convert between byte indices into a string which is built up of several
//! slices in a whole document, and byte indices into that whole document.
use crate::unist::Point;
use alloc::{vec, vec::Vec};
/// Each stop repr... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/mdx.rs | Rust | use alloc::{boxed::Box, string::String};
/// Signal used as feedback when parsing MDX ESM/expressions.
#[derive(Clone, Debug)]
pub enum Signal {
/// A syntax error.
///
/// `markdown-rs` will crash with error message `String`, and convert the
/// `usize` (byte offset into `&str` passed to `MdxExpressio... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/mdx_collect.rs | Rust | //! Collect info for MDX.
use crate::event::{Event, Kind, Name};
use crate::util::slice::{Position, Slice};
use alloc::{string::String, vec, vec::Vec};
pub type Stop = (usize, usize);
#[derive(Debug)]
pub struct Result {
pub value: String,
pub stops: Vec<Stop>,
}
pub fn collect(
events: &[Event],
by... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/mod.rs | Rust | //! Utilities used when processing markdown.
pub mod char;
pub mod character_reference;
pub mod constant;
pub mod edit_map;
pub mod encode;
pub mod gfm_tagfilter;
pub mod identifier;
pub mod infer;
pub mod line_ending;
pub mod location;
pub mod mdx;
pub mod mdx_collect;
pub mod normalize_identifier;
pub mod sanitize_u... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/normalize_identifier.rs | Rust | //! Normalize identifiers.
use alloc::string::String;
/// Normalize an identifier, as found in [references][label_end] and
/// [definitions][definition], so it can be compared when matching.
///
/// This collapsed whitespace found in markdown (`\t`, `\r`, `\n`, and ` `)
/// into one space, trims it (as in, dropping t... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/sanitize_uri.rs | Rust | //! Make urls safe.
use crate::util::encode::encode;
use alloc::{format, string::String, vec::Vec};
/// Make a value safe for injection as a URL.
///
/// This encodes unsafe characters with percent-encoding and skips already
/// encoded sequences (see `normalize` below).
/// Further unsafe characters are encoded as c... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/skip.rs | Rust | //! Move across lists of events.
use crate::event::{Event, Kind, Name};
/// Skip from `index`, optionally past `names`.
pub fn opt(events: &[Event], index: usize, names: &[Name]) -> usize {
skip_opt_impl(events, index, names, true)
}
/// Skip from `index`, optionally past `names`, backwards.
pub fn opt_back(even... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/slice.rs | Rust | //! Deal with bytes.
use crate::event::{Event, Kind, Point};
use crate::util::constant::TAB_SIZE;
use alloc::{format, string::String, vec};
use core::str;
/// A range between two points.
#[derive(Debug)]
pub struct Position<'a> {
/// Start point.
pub start: &'a Point,
/// End point.
pub end: &'a Point... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
src/util/unicode.rs | Rust | //! Info on Unicode.
/// List of characters that are considered punctuation.
///
/// > 👉 **Important**: this module is generated by `generate/src/main.rs`.
/// > It is generate from the latest Unicode data.
///
/// Rust does not contain an `is_punctuation` method on `char`, while it does
/// support [`is_ascii_alphan... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/attention.rs | Rust | use markdown::{
mdast::{Emphasis, Node, Paragraph, Root, Strong, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn attention() -> Result<(), message::Message> {
let danger = Op... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/autolink.rs | Rust | use markdown::{
mdast::{Link, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn autolink() -> Result<(), message::Message> {
let danger = Options {
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/block_quote.rs | Rust | use markdown::{
mdast::{Blockquote, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn block_quote() -> Result<(), message::Message> {
assert_eq!(
to_html("> # a\... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/character_escape.rs | Rust | use markdown::{
mdast::{Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn character_escape() -> Result<(), message::Message> {
let danger = Options {
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/character_reference.rs | Rust | use markdown::{
mdast::{Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn character_reference() -> Result<(), message::Message> {
assert_eq!(
to_... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/code_fenced.rs | Rust | use markdown::{
mdast::{Code, Node, Root},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn code_fenced() -> Result<(), message::Message> {
assert_eq!(
to_html("```\n<\n >\n```"),
"<... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/code_indented.rs | Rust | use markdown::{
mdast::{Code, Node, Root},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn code_indented() -> Result<(), message::Message> {
assert_eq!(
to_html(" a simpl... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/code_text.rs | Rust | use markdown::{
mdast::{InlineCode, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn code_text() -> Result<(), message::Message> {
let danger = Options ... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/commonmark.rs | Rust | //! `CommonMark` test suite.
// > 👉 **Important**: this module is generated by `generate/src/main.rs`.
// > It is generate from the latest CommonMark website.
use markdown::{message, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[rustfmt::skip]
#[test]
fn commonmark() -> Result<... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/definition.rs | Rust | use markdown::{
mdast::{Definition, Node, Root},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn definition() -> Result<(), message::Message> {
let danger = Options {
compil... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/frontmatter.rs | Rust | use markdown::{
mdast::{Node, Root, Toml, Yaml},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn frontmatter() -> Result<(), message::Message> {
let frontmatter = Options {
parse: ParseOpti... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/fuzz.rs | Rust | use markdown::{mdast, message, to_html, to_html_with_options, to_mdast, Options};
use pretty_assertions::assert_eq;
#[test]
fn fuzz() -> Result<(), message::Message> {
assert_eq!(
to_html("[\n~\na\n-\n\n"),
"<h2>[\n~\na</h2>\n",
"1: label, blank lines, and code"
);
// The first lin... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/gfm_autolink_literal.rs | Rust | #![allow(clippy::needless_raw_string_hashes)]
// To do: clippy introduced this in 1.72 but breaks when it fixes it.
// Remove when solved.
use markdown::{
mdast::{Link, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Options, ParseOptions,
};
use pretty... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/gfm_footnote.rs | Rust | use markdown::{
mdast::{FootnoteDefinition, FootnoteReference, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn gfm_footnote() -> Result<(), message::Message> {
ass... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/gfm_strikethrough.rs | Rust | #![allow(clippy::needless_raw_string_hashes)]
// To do: clippy introduced this in 1.72 but breaks when it fixes it.
// Remove when solved.
use markdown::{
mdast::{Delete, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Options, ParseOptions,
};
use pret... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/gfm_table.rs | Rust | use markdown::{
mdast::{AlignKind, InlineCode, Node, Root, Table, TableCell, TableRow, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn gfm_table() -> Result<(), message::Message>... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/gfm_tagfilter.rs | Rust | #![allow(clippy::needless_raw_string_hashes)]
// To do: clippy introduced this in 1.72 but breaks when it fixes it.
// Remove when solved.
use markdown::{message, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
fn gfm_tagfilter() -> Result<(), message::Message> {
assert_... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/gfm_task_list_item.rs | Rust | use markdown::{
mdast::{Emphasis, List, ListItem, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn gfm_task_list_item() -> Result<(), message::Message> {
assert_eq!... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/hard_break_escape.rs | Rust | use markdown::{
mdast::{Break, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn hard_break_escape() -> Result<(), message::Message> {
assert_eq!(
to_html("foo\\... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/hard_break_trailing.rs | Rust | use markdown::{
mdast::{Break, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn hard_break_trailing() -> Result<(), message::Message> {
assert_eq!(
to_html("foo... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/heading_atx.rs | Rust | use markdown::{
mdast::{Heading, Node, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn heading_atx() -> Result<(), message::Message> {
assert_eq!(
to_html("# foo"),
"<h... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/heading_setext.rs | Rust | use markdown::{
mdast::{Heading, Node, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn heading_setext() -> Result<(), message::Message> {
assert_eq!(
to_html("Foo *bar*\n======... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/html_flow.rs | Rust | use markdown::{
mdast::{Html, Node, Root},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn html_flow() -> Result<(), message::Message> {
let danger = Options {
compile: Comp... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/html_text.rs | Rust | use markdown::{
mdast::{Html, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn html_text() -> Result<(), message::Message> {
let danger = Options {
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/image.rs | Rust | use markdown::{
mdast::{Definition, Image, ImageReference, Node, Paragraph, ReferenceKind, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn image() -> Result<(), message::Me... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/link_reference.rs | Rust | use markdown::{
mdast::{Definition, LinkReference, Node, Paragraph, ReferenceKind, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn link_reference() -> Result<(), message::M... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/link_resource.rs | Rust | use markdown::{
mdast::{Image, Link, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Options,
};
use pretty_assertions::assert_eq;
#[test]
fn link_resource() -> Result<(), message::Message> {
let danger = Options {
compile: Co... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/list.rs | Rust | use markdown::{
mdast::{List, ListItem, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn list() -> Result<(), message::Message> {
let danger = Options {... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/math_flow.rs | Rust | use markdown::{
mdast::{Math, Node, Root},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn math_flow() -> Result<(), message::Message> {
let math = Options {
parse: ParseOptions {
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/math_text.rs | Rust | use markdown::{
mdast::{InlineMath, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn math_text() -> Result<(), message::Message> {
let math = Options {
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/mdx_esm.rs | Rust | mod test_utils;
use markdown::{
mdast::{MdxjsEsm, Node, Root},
message, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
use test_utils::swc::{parse_esm, parse_expression};
#[test]
fn mdx_esm() -> Result<(), message::Message> {
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/mdx_expression_flow.rs | Rust | mod test_utils;
use markdown::{
mdast::{
AttributeContent, AttributeValue, AttributeValueExpression, Blockquote, MdxFlowExpression,
MdxJsxAttribute, MdxJsxTextElement, MdxTextExpression, Node, Paragraph, Root, Text,
},
message, to_html_with_options, to_mdast,
unist::Position,
Constru... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/mdx_expression_text.rs | Rust | mod test_utils;
use markdown::{
mdast::{Blockquote, MdxTextExpression, Node, Paragraph, Root, Text},
message, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
use test_utils::swc::{parse_esm, parse_expression};
/// Note: these test... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/mdx_jsx_flow.rs | Rust | mod test_utils;
use markdown::{
mdast::{List, ListItem, MdxJsxFlowElement, Node, Paragraph, Root, Text},
message, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
use test_utils::swc::{parse_esm, parse_expression};
#[test]
fn mdx_j... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/mdx_jsx_text.rs | Rust | mod test_utils;
use markdown::{
mdast::{
AttributeContent, AttributeValue, AttributeValueExpression, Emphasis, MdxFlowExpression,
MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement, MdxJsxTextElement, Node,
Paragraph, Root, Text,
},
message, to_html_with_options, to_mdast,... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/mdx_swc.rs | Rust | mod test_utils;
use markdown::{message, to_html_with_options, Constructs, Options, ParseOptions};
use pretty_assertions::assert_eq;
use test_utils::swc::{parse_esm, parse_expression};
#[test]
fn mdx_swc() -> Result<(), message::Message> {
let swc = Options {
parse: ParseOptions {
constructs: Co... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_bom.rs | Rust | use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn bom() {
assert_eq!(to_html("\u{FEFF}"), "", "should ignore just a bom");
assert_eq!(
to_html("\u{FEFF}# hea\u{FEFF}ding"),
"<h1>hea\u{FEFF}ding</h1>",
"should ignore a bom"
);
}
| wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_dangerous_html.rs | Rust | use markdown::{message, to_html, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
fn dangerous_html() -> Result<(), message::Message> {
let danger = &Options {
compile: CompileOptions {
allow_dangerous_html: true,
allow_dangerous_protocol: tr... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_dangerous_protocol.rs | Rust | use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn dangerous_protocol_autolink() {
assert_eq!(
to_html("<javascript:alert(1)>"),
"<p><a href=\"\">javascript:alert(1)</a></p>",
"should be safe by default"
);
assert_eq!(
to_html("<http://a>"),
"<p><a ... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_default_line_ending.rs | Rust | use markdown::{message, to_html, to_html_with_options, CompileOptions, LineEnding, Options};
use pretty_assertions::assert_eq;
#[test]
fn default_line_ending() -> Result<(), message::Message> {
assert_eq!(
to_html("> a"),
"<blockquote>\n<p>a</p>\n</blockquote>",
"should use `\\n` default"
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_line_ending.rs | Rust | use markdown::{message, to_html, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
fn line_ending() -> Result<(), message::Message> {
let danger = &Options {
compile: CompileOptions {
allow_dangerous_html: true,
allow_dangerous_protocol: true,... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_soft_break.rs | Rust | use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn soft_break() {
assert_eq!(
to_html("foo\nbaz"),
"<p>foo\nbaz</p>",
"should support line endings"
);
assert_eq!(
to_html("foo \n baz"),
"<p>foo\nbaz</p>",
"should trim spaces around line endi... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_tabs.rs | Rust | use markdown::{message, to_html, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
fn tabs_flow() -> Result<(), message::Message> {
let danger = &Options {
compile: CompileOptions {
allow_dangerous_html: true,
allow_dangerous_protocol: true,
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_url.rs | Rust | use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn url() {
assert_eq!(
to_html("<https://%>"),
"<p><a href=\"https://%25\">https://%</a></p>",
"should support incorrect percentage encoded values (0)"
);
assert_eq!(
to_html("[](<%>)"),
"<p><a href=\"... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/misc_zero.rs | Rust | use markdown::{
mdast::{Node, Root},
message, to_html, to_mdast,
unist::Position,
};
use pretty_assertions::assert_eq;
#[test]
fn zero() -> Result<(), message::Message> {
assert_eq!(to_html(""), "", "should support no markdown");
assert_eq!(
to_html("asd\0asd"),
"<p>asd�asd</p>",
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/serde.rs | Rust | use markdown::{mdast::Node, message::Message, Constructs, ParseOptions};
use test_utils::swc::{parse_esm, parse_expression};
mod test_utils;
#[allow(unused)]
#[derive(Debug)]
enum Error {
Mdast(Message),
Serde(serde_json::Error),
}
#[test]
#[cfg(feature = "serde")]
fn serde_constructs() -> Result<(), Error> {... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/test_utils/mod.rs | Rust | pub mod swc;
pub mod swc_utils;
| wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/test_utils/swc.rs | Rust | //! Bridge between `markdown-rs` and SWC.
use crate::test_utils::swc_utils::{create_span, RewritePrefixContext};
use markdown::{MdxExpressionKind, MdxSignal};
use std::rc::Rc;
use swc_core::common::{
comments::{Comment, SingleThreadedComments, SingleThreadedCommentsMap},
source_map::SmallPos,
BytePos, File... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/test_utils/swc_utils.rs | Rust | //! Lots of helpers for dealing with SWC, particularly from unist, and for
//! building its ES AST.
use swc_core::common::{BytePos, Span, DUMMY_SP};
use swc_core::ecma::visit::{noop_visit_mut_type, VisitMut};
/// Visitor to fix SWC byte positions by removing a prefix.
///
/// > 👉 **Note**: SWC byte positions are off... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/text.rs | Rust | use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn text() {
assert_eq!(
to_html("hello $.;'there"),
"<p>hello $.;'there</p>",
"should support ascii text"
);
assert_eq!(
to_html("Foo χρῆν"),
"<p>Foo χρῆν</p>",
"should support unicode text"
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
tests/thematic_break.rs | Rust | use markdown::{
mdast::{Node, Root, ThematicBreak},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn thematic_break() -> Result<(), message::Message> {
assert_eq!(
to_html("***\n---\n___"),
... | wooorm/markdown-rs | 1,459 | CommonMark compliant markdown parser in Rust with ASTs and extensions | Rust | wooorm | Titus | |
build.js | JavaScript | /**
* @import {Grammar} from '@wooorm/starry-night'
*/
/**
* @typedef {Grammar['patterns'][number]} Rule
*
* @typedef {'autolink' | 'code-indented' | 'html'} ConditionCommonmark
* @typedef {'directive' | 'frontmatter' | 'gfm' | 'github' | 'math' | 'mdx'} ConditionExtension
* @typedef {ConditionCommonmark | Cond... | wooorm/markdown-tm-language | 51 | really good syntax highlighting for markdown and MDX | JavaScript | wooorm | Titus | |
example/index.css | CSS | * {
box-sizing: border-box;
line-height: calc(1 * (1em + 1ex));
}
a {
color: var(--color-hl);
text-decoration: none;
transition: 200ms;
transition-property: color;
}
a:focus,
a:hover,
a:target {
color: inherit;
}
body {
margin: 0;
}
code,
kbd,
.draw,
.write {
font-family:
ui-monospace,
SF... | wooorm/markdown-tm-language | 51 | really good syntax highlighting for markdown and MDX | JavaScript | wooorm | Titus | |
example/index.html | HTML | <!doctypehtml>
<meta charset=utf8>
<title>markdown-tm-language</title>
<meta content=markdown-tm-language property=og:title>
<meta content=initial-scale=1,width=device-width name=viewport>
<meta content="markdown grammar" name=description>
<meta content="markdown grammar" property=og:description>
<meta content=//raw.gi... | wooorm/markdown-tm-language | 51 | really good syntax highlighting for markdown and MDX | JavaScript | wooorm | Titus | |
example/index.jsx | JavaScript (JSX) | /* eslint-env browser */
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/// <reference lib="dom" />
import sourceCss from '@wooorm/starry-night/source.css'
import sourceDiff from '@wooorm/starry-night/source.diff'
import sourceJson from '@wooorm/starry-night/source.json'
import sourceJs from '@wooorm/starr... | wooorm/markdown-tm-language | 51 | really good syntax highlighting for markdown and MDX | JavaScript | wooorm | Titus | |
source.mdx.js | JavaScript | /* eslint-disable no-template-curly-in-string */
/**
* @import {Grammar} from "@wooorm/starry-night"
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.mdx'],
names: ['mdx'],
patterns: [
{
include: '#markdown-frontmatter'
},
{
include: '#markdown-sections'
}
],
repositor... | wooorm/markdown-tm-language | 51 | really good syntax highlighting for markdown and MDX | JavaScript | wooorm | Titus | |
text.md.js | JavaScript | /* eslint-disable no-template-curly-in-string */
/**
* @import {Grammar} from "@wooorm/starry-night"
*/
/** @type {Grammar} */
const grammar = {
extensions: [
'.md',
'.livemd',
'.markdown',
'.mdown',
'.mdwn',
'.mkd',
'.mkdn',
'.mkdown',
'.ronn',
'.scd',
'.workbook'
],
... | wooorm/markdown-tm-language | 51 | really good syntax highlighting for markdown and MDX | JavaScript | wooorm | Titus | |
examples/lib.rs | Rust | extern crate mdxjs;
/// Example that compiles the example MDX document from <https://mdxjs.com>
/// to JavaScript.
fn main() -> Result<(), markdown::message::Message> {
println!(
"{}",
mdxjs::compile(
r##"
import {Chart} from './snowfall.js'
export const year = 2018
# Last year’s snowf... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/configuration.rs | Rust | //! Configuration.
use crate::mdx_plugin_recma_document::JsxRuntime;
/// Like `Constructs` from `markdown-rs`.
///
/// You can’t use:
///
/// * `autolink`
/// * `code_indented`
/// * `html_flow`
/// * `html_text`
/// * `mdx_esm`
/// * `mdx_expression_flow`
/// * `mdx_expression_text`
/// * `mdx_jsx_fl... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/hast.rs | Rust | //! HTML syntax tree: [hast][].
//!
//! [hast]: https://github.com/syntax-tree/hast
#![allow(dead_code)]
#![allow(clippy::to_string_trait_impl)]
extern crate alloc;
extern crate markdown;
#[allow(unused_imports)]
pub use markdown::mdast::MdxJsxAttribute;
pub use markdown::mdast::{AttributeContent, AttributeValue, Stop... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/hast_util_to_swc.rs | Rust | //! Turn an HTML AST into a JavaScript AST.
//!
//! Port of <https://github.com/syntax-tree/hast-util-to-estree>, by the same
//! author:
//!
//! (The MIT License)
//!
//! Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
//!
//! Permission is hereby granted, free of charge, to any person obtaining
//! a copy of ... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/lib.rs | Rust | //! Public API of `mdxjs-rs`.
//!
//! This module exposes primarily [`compile()`][].
//!
//! * [`compile()`][]
//! — turn MDX into JavaScript
#![deny(clippy::pedantic)]
#![allow(clippy::implicit_hasher)]
#![allow(clippy::must_use_candidate)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::struct_excessive_bool... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/mdast_util_to_hast.rs | Rust | //! Turn a markdown AST into an HTML AST.
//!
//! Port of <https://github.com/syntax-tree/mdast-util-to-hast>, by the same
//! author:
//!
//! (The MIT License)
//!
//! Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
//!
//! Permission is hereby granted, free of charge, to any person obtaining
//! a copy of thi... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/mdx_plugin_recma_document.rs | Rust | //! Turn a JavaScript AST, coming from MD(X), into a component.
//!
//! Port of <https://github.com/mdx-js/mdx/blob/main/packages/mdx/lib/plugin/recma-document.js>,
//! by the same author.
use crate::hast_util_to_swc::Program;
use crate::swc_utils::{
bytepos_to_point, create_call_expression, create_ident, create_i... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/mdx_plugin_recma_jsx_rewrite.rs | Rust | //! Rewrite JSX tags to accept them from props and an optional provider.
//!
//! Port of <https://github.com/mdx-js/mdx/blob/main/packages/mdx/lib/plugin/recma-jsx-rewrite.js>,
//! by the same author.
use crate::hast_util_to_swc::Program;
use crate::swc_utils::{
create_binary_expression, create_bool_expression, cr... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/swc.rs | Rust | //! Bridge between `markdown-rs` and SWC.
extern crate markdown;
use crate::swc_utils::{create_span, DropContext, RewritePrefixContext, RewriteStopsContext};
use markdown::{mdast::Stop, Location, MdxExpressionKind, MdxSignal};
use std::rc::Rc;
use swc_core::common::{
comments::{Comment, Comments, SingleThreadedCo... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/swc_util_build_jsx.rs | Rust | //! Turn JSX into function calls.
use crate::hast_util_to_swc::Program;
use crate::mdx_plugin_recma_document::JsxRuntime;
use crate::swc_utils::{
bytepos_to_point, create_bool_expression, create_call_expression, create_ident,
create_ident_expression, create_member_expression_from_str, create_null_expression,
... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
src/swc_utils.rs | Rust | //! Lots of helpers for dealing with SWC, particularly from unist, and for
//! building its ES AST.
use markdown::{
id_cont, id_start,
mdast::Stop,
unist::{Point, Position},
Location,
};
use swc_core::ecma::ast::{
BinExpr, BinaryOp, Bool, CallExpr, Callee, ComputedPropName, Expr, ExprOrSpread, Ide... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
tests/test.rs | Rust | extern crate mdxjs;
use mdxjs::{compile, JsxRuntime, Options};
use pretty_assertions::assert_eq;
#[test]
fn simple() -> Result<(), markdown::message::Message> {
assert_eq!(
compile("", &Options::default())?,
"import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";
function _create... | wooorm/mdxjs-rs | 521 | Compile MDX to JavaScript in Rust | Rust | wooorm | Titus | |
script/analyze.js | JavaScript | /**
* @import {Element} from 'hast'
* @import {Style} from './crawl.js'
*/
import fs from 'node:fs/promises'
import path from 'node:path'
import {csvFormat} from 'd3-dsv'
import {s} from 'hastscript'
import {toHtml} from 'hast-util-to-html'
const filesRaw = await fs.readdir(new URL('../data', import.meta.url))
/*... | wooorm/npm-esm-vs-cjs | 243 | Data on the share of ESM vs CJS on the public npm registry | JavaScript | wooorm | Titus | |
script/crawl.js | JavaScript | /**
* @import {PackumentResult, Packument} from 'pacote'
*/
/**
* @typedef {'cjs' | 'dual' | 'esm' | 'faux'} Style
* Style.
*/
import fs from 'node:fs/promises'
import process from 'node:process'
import dotenv from 'dotenv'
import {npmHighImpact} from 'npm-high-impact'
import pacote from 'pacote'
dotenv.confi... | wooorm/npm-esm-vs-cjs | 243 | Data on the share of ESM vs CJS on the public npm registry | JavaScript | wooorm | Titus | |
index.js | JavaScript | export {npmHighImpact, npmTopDependents, npmTopDownloads} from './lib/index.js'
| wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
lib/index.js | JavaScript | export {top as npmHighImpact} from './top.js'
export {topDependent as npmTopDependents} from './top-dependent.js'
export {topDownload as npmTopDownloads} from './top-download.js'
| wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
lib/top-dependent.js | JavaScript | export const topDependent = [
'typescript',
'eslint',
'react',
'mocha',
'@types/node',
'jest',
'prettier',
'webpack',
'react-dom',
'@babel/core',
'babel-loader',
'eslint-plugin-import',
'rimraf',
'chai',
'@types/jest',
'lodash',
'@babel/preset-env',
'babel-eslint',
'babel-core',
... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
lib/top-download.js | JavaScript | export const topDownload = [
'semver',
'ansi-styles',
'debug',
'chalk',
'minimatch',
'supports-color',
'strip-ansi',
'ms',
'ansi-regex',
'string-width',
'tslib',
'brace-expansion',
'lru-cache',
'wrap-ansi',
'emoji-regex',
'glob',
'commander',
'color-convert',
'color-name',
'type-... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
lib/top.js | JavaScript | export const top = [
'semver',
'ansi-styles',
'debug',
'chalk',
'minimatch',
'supports-color',
'strip-ansi',
'ms',
'ansi-regex',
'string-width',
'tslib',
'brace-expansion',
'lru-cache',
'wrap-ansi',
'emoji-regex',
'glob',
'commander',
'color-convert',
'color-name',
'type-fest',
... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
script/build-top-dependent.js | JavaScript | /* eslint-disable no-await-in-loop */
/**
* @import {ResultDependentPackagesCount} from './crawl-packages.js'
*/
import fs from 'node:fs/promises'
/** @type {Array<ResultDependentPackagesCount>} */
const data = []
let chunk = 0
while (true) {
const basename = 'dependent-packages-count-' + chunk + '.json'
cons... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
script/build-top-download.js | JavaScript | /* eslint-disable no-await-in-loop */
/**
* @import {ResultDownloads} from './crawl-packages.js'
*/
import fs from 'node:fs/promises'
/** @type {Array<ResultDownloads>} */
const data = []
let chunk = 0
while (true) {
const basename = 'downloads-' + chunk + '.json'
const file = new URL('../data/' + basename, i... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
script/build-top.js | JavaScript | import fs from 'node:fs/promises'
import {topDependent} from '../lib/top-dependent.js'
import {topDownload} from '../lib/top-download.js'
const result = [...new Set([...topDownload, ...topDependent])]
await fs.writeFile(
new URL('../lib/top.js', import.meta.url),
'export const top = ' + JSON.stringify(result, nul... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
script/crawl-packages.js | JavaScript | /* eslint-disable max-depth */
/* eslint-disable camelcase */
/* eslint-disable no-await-in-loop */
/**
* @typedef Package
* @property {number} dependent_packages_count
* @property {number} downloads
* @property {string} name
*
* @typedef ResultDependentPackagesCount
* @property {number} dependent_packages_coun... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
test.js | JavaScript | import assert from 'node:assert/strict'
import test from 'node:test'
import {npmHighImpact, npmTopDependents, npmTopDownloads} from 'npm-high-impact'
test('npmHighImpact', function () {
assert.ok(Array.isArray(npmHighImpact), 'should be a list')
assert.ok(
npmHighImpact.includes('supports-color'),
'should ... | wooorm/npm-high-impact | 100 | The high-impact (popular) packages of npm | JavaScript | wooorm | Titus | |
babel.config.cjs | JavaScript | module.exports = {
presets: [['@babel/preset-react', {runtime: 'automatic'}]]
}
| wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
index.css | CSS | :root {
--ff-sans: system-ui;
--ff-mono: 'San Francisco Mono', 'Monaco', 'Consolas', 'Lucida Console',
'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
--gray-0: #fafbfc;
--gray-2: #e1e4e8;
--gray-4: #959da5;
--gray-6: #586069;
--gray-8: #2f363d;
--gray-10: #1b1f23;
--blue-4: #2188ff;
... | wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
node-loader-wo-react.config.js | JavaScript | import * as xdm from 'xdm/esm-loader.js'
import * as babel from '@node-loader/babel'
const loader = {loaders: [xdm, babel]}
export default loader
| wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
node-loader.config.js | JavaScript | import * as xdm from 'xdm/esm-loader.js'
import * as babel from '@node-loader/babel'
import * as serverDomWebpack from 'react-server-dom-webpack/node-loader'
const loader = {loaders: [serverDomWebpack, xdm, babel]}
export default loader
| wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
script/bundle.js | JavaScript | #!/usr/bin/env node
import fs from 'node:fs'
import url from 'node:url'
import path from 'node:path'
import process from 'node:process'
import webpack from 'webpack'
import ReactServerWebpackPlugin from 'react-server-dom-webpack/plugin'
const production = process.env.NODE_ENV === 'production'
fs.mkdirSync('build', {r... | wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
script/generate.server.js | JavaScript | #!/usr/bin/env node
import fs from 'node:fs'
import process from 'node:process'
import React from 'react'
import {pipeToNodeWritable} from 'react-server-dom-webpack/writer'
import Content from '../src/content.server.mdx'
const manifest = fs.readFileSync('build/react-client-manifest.json')
pipeToNodeWritable(
React.... | wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
script/prerender.js | JavaScript | #!/usr/bin/env node
import {Buffer} from 'node:buffer'
import {promises as fs} from 'node:fs'
import path from 'node:path'
import url from 'node:url'
import React from 'react'
import {renderToString} from 'react-dom/server.js'
import {createFromReadableStream} from 'react-server-dom-webpack'
import {bin2png} from 'bin2... | wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
src/counter.client.js | JavaScript | import React from 'react'
import Confetti from 'react-confetti'
const {useState} = React
export function Counter() {
const [coords, setCoords] = useState(undefined)
const [pieces, setPieces] = useState(0)
const [count, setCount] = useState(0)
return (
<>
You{' '}
<button type="button" onClick... | wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
src/index.client.js | JavaScript | import {hydrateRoot} from 'react-dom'
import {createFromFetch} from 'react-server-dom-webpack'
import {png2bin} from 'png2bin'
import {Root} from './root.client.js'
window.addEventListener('DOMContentLoaded', main)
async function main() {
const $root = document.querySelector('#root')
const $payload = document.que... | wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus | |
src/phyllotaxis.server.js | JavaScript | const theta = Math.PI * (3 - Math.sqrt(6))
export function Phyllotaxis(props) {
const {size, step, length, radius} = props
return (
<svg
width={size}
height={size}
viewBox={[0, 0, size, size].join(' ')}
style={{
color: 'var(--hl)',
display: 'block',
margin: '0 a... | wooorm/server-components-mdx-demo | 123 | React server components + MDX | JavaScript | wooorm | Titus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.