Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first working prototype #1

Closed
wants to merge 1 commit into from
Closed

Conversation

mbovel
Copy link
Collaborator

@mbovel mbovel commented Aug 27, 2019

No description provided.

describe: "Output file",
type: "string"
}),
argv => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can destructure argv here directly for extra street cred

const om = toOM(parse(inputString));
const outputString = renderToStaticMarkup(React.createElement(Document, om));
if (output) fs.writeFileSync(output, outputString);
// tslint:disable-next-line:no-console

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the no-console rule of TSLint isn't very appropriate for a CLI

export function Ref({ idRef }: RefOM) {
const section = idRef.target;
if (section) return <a href={"#" + section.id}>{section.title}</a>;
else return <strong>???</strong>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add a title attribute for better UX

return (
<section id={id}>
<h1>
{counter.join(".")} {toReact(title)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omg how horrible to not put a dot at the end

import { SectionOM } from "./SectionOM";
import { StrongOM } from "./StrongOM";

export type OM = DocumentOM | SectionOM | ParagraphOM | EmphasisOM | StrongOM | RefOM;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could perhaps all be in one file

@mbovel mbovel closed this Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants