📺 Develpreneur YouTube Episode

Video + transcript

Ascii Doc Tutorial - Part 1

2021-11-25 •Youtube

Detailed Notes

We always need to document our code and processes. That does not mean we always do. Ascii Doc is a tool that can make it easy for us to quickly create documentation that looks good and in many formats.

Ascii Doc Link: https://asciidoc-py.github.io

Transcript Text
[Music]
today we are going to be talking about
ascii docs
which is a
text editor
technique that we can use to simplify
our documentation
so what is ascii docs well ascii docs is
a
text document format for writing notes
documentation
articles
books and so on it's just a way
of simplifying like a text editor
where
your text is readable in pretty much any
format like if you're using a text
editor if you're using vimeo
uh navigate bim nano
uh
basically from any command line editor
you can read the documentation cleanly
and what's cool about this is
ascii docs allows you to convert this
text into essentially any format so you
can do html pdf
xhtml xml
so basically you write something that's
clean easy to read
and then you can essentially translate
it to any type of format that you want
and ascii docs is also highly
configurable
it has plugins it has themes
you can also inject code you can inject
html i mean you can do so much with it
and so here's an example of
four different flavors of the same
document
so down here in the right hand corner is
a
clean man
uh
text written in ascii code
above it is a the same uh text in pdf
apache fop
uh to the top left is your standard pdf
file so if you actually try to read the
text of pdf this is what you would see
and then in the lower left is
how this text would look in html
so in order to translate this clean text
into html you have to have all these
different tags pdf you have to have all
the different pdf syntax
uh pdf fob it see it's a little cleaner
to read but
you still have a lot more syntax in here
than you would just in a plain text
document
so this is kind of the beauty
of using ascii doc
it lets you write a very clean readable
text document that you can read from
any essentially command line
text editor whatever
but you can convert this document to any
format that you need for the web
uh or even just for straight up
documentation
so if you want to create like a pdf book
or a manual that you could publish with
your software
you could take the ascii doc here and
then just
run it through the compiler and it would
generate the man file it would generate
the pdf file
or the ebook file that you could then
publish
all right so that's it for the slides
for now so let's actually get out here
this is going to be more of a hands-on
today
all right so out here let's start by
going to the ascii homepage
so
asciidocs.org
is the base homepage for ascii docs
it's got a fairly straightforward
installation section here
down at the bottom
it's installed from a github repository
uh which by the way i found out that
asking docs is
kind of also the de facto documentation
format that
github is using
so if you want to install
on windows your setups here it's pretty
straightforward
um
linux is also pretty straightforward
mac
has a
little uh issue right now so
homebrew has kind of been disabled from
the pseudo level
so if you want to install
ascii docs on a mac you have to actually
configure
the user rights to the folders for the
installation
the other thing it's going to want is
it's also going to require python 3
for your installation so that you can
actually run python
to convert the documentation
so for instance
uh we have
to test the installation so we have a
doc asciidoc.txt
i've got this installed already
here
development
deducts
citation
so here we have an ascii.txt
and as you can see it's just a straight
text document
but using the ascii
doc format
and we'll walk through what each of
these syntaxes mean here
but just if i scroll through this you
can see that this is a very readable
document it's very clean
uh i mean and you can you can understand
it
now
if i close this document here
and i run the converter
so if i ran this python ascii docs pi
against the text file
i've already done
so here we would see
the html version of that same text file
so now we have all of our links
and we have all the documentation
this is the power of ascii docs so ascii
docs can look very clean
from a ascii perspective from a command
line perspective or text document
but then you can convert it to any
format that you need
and then once you convert it you can
then deploy it with your application
either be an e-reader file
or you can deploy the html straight to
your website
all right so i'm going to jump out to
this other url here
uh
spartan.github.io
asky.box
now you can install this yourself
but
there's a couple different ones of these
online
so you don't really need to do
the setup yourself this is just kind of
a text editor that you can type and
type your ascii code here and you'll see
the
output over here
so the first thing
i want to show you is so if we look at
the
ascii.txt
we have this header information here
drop this in here so this
website
currently ignores this they're running a
different theme
but you can put in a header information
this way
and it will have like author information
email
different types of format text
documentation icons numbering and
website
uh i believe this guy is running a ruby
implementation so the other way to
display your header
is
with
the underlines
or we can do
there we are dashes
we have one two three four five six
seven eight nine ten eleven twelve
so twelve dashes
gets you a title of your document
and the little block underneath it so
that everything you type is now going to
be inside of our block
we could put some text in there
with some markup
so here on the left
there is no reason to prefer
this particular markup
it has all the features footers and so
on
and on the right it
is kind of cut off right now
this is using the uh pac-man
uh i believe this has like uh ruby and
pac-man for this particular editor
there's some things we can do so
if you're thinking like html
we'll leave our
title here
and let's put in a
header
so headers in html
are the typical h1 through h5
well in
ascii docs
you can represent the levels or your
headers
like
so we have
the dashes
two three four five six seven so seven
dashes
is equivalent of
h1
as you can see you start with your
header
you follow it with the dashes
and it's translated to a header
anything after the dash is it's just
plain text
actually what you have to do is you have
to make sure that you have
the dash under each
character that represents your title or
your
headers
so here we have example one
then you have your different levels so
this is h2
this is represented by squiggles
if shift backwards hyphen
and you have your carrots and then
pluses for level four
we have our examples
so
one
dashes
two
wiggles
three
are carrots
h4
or plus
and we can also represent these
the same way with equals
so if i do equal equal
i can then do level one
which is our h1
if i do three
now in h2
this is kind of a cleaner way of doing
your headers or your
different levels
level three
as you can see over here it's fairly
readable it translates really well
right so if we just want text you can
just start typing text
creates any text underneath like a
a p tag in html so it's like p
so there's no enters you have to put
actual breaks
if you want a title
inside of your documentation
you start with a period
and then you just do
title
then once you put some text underneath
it you see that the title pops up
paragraph
next
now if i want to
do a literal paragraph
you have to start with a space
and you'll see it puts a
block around it
and then what you do here is everything
you type
it reads the enter key
so this is now traded like a
three
let's pre-format it
then now you can do all your indentation
anytime you put a space in between
it will put a block
for those horizontal lines
some other things that are cool with
using ascii
you can
do tip
now it becomes a tip block
if you apply formatting you can change
icons so this could be like an
information icon a warning icon
you can also do things like important
caution
warnings
yep text
a warning block
and a caution block now this guy
doesn't have the icons installed
but like i said this could be
uh just like a little notepad
or
an information icon
uh this could be like an alert
exclamation point
uh this could be like a red warning stop
sign
uh caution
the other thing you can do with these is
you can also
essentially they're
a a block so every time you keep typing
it just keeps adding it
it keeps expanding
you can format that
another way you could also do a note
so if we want to change this up here
with our title
but then also make this a note
do this
all caps
and now it creates a note block
and you can also change your note to be
an icon
as well
you could also do things like
code
if you give it a title
you put in the source so this is like
the code tag in html
and then you can actually put in your
code
if you installed the theme or the plugin
for the code
the code will actually be color coded as
if it was in an editor
[Music]
you
Transcript Segments
1.28

[Music]

28.32

today we are going to be talking about

30.48

ascii docs

31.84

which is a

34

text editor

35.68

technique that we can use to simplify

38.239

our documentation

40

so what is ascii docs well ascii docs is

43.76

a

44.64

text document format for writing notes

47.12

documentation

48.559

articles

50.079

books and so on it's just a way

53.84

of simplifying like a text editor

57.84

where

59.44

your text is readable in pretty much any

61.52

format like if you're using a text

63.28

editor if you're using vimeo

66.24

uh navigate bim nano

69.52

uh

70.64

basically from any command line editor

72.56

you can read the documentation cleanly

75.52

and what's cool about this is

78.159

ascii docs allows you to convert this

81.36

text into essentially any format so you

84.159

can do html pdf

86.64

xhtml xml

89.36

so basically you write something that's

91.119

clean easy to read

93.439

and then you can essentially translate

95.6

it to any type of format that you want

98.64

and ascii docs is also highly

100.32

configurable

102

it has plugins it has themes

105.36

you can also inject code you can inject

108.32

html i mean you can do so much with it

112.399

and so here's an example of

115.28

four different flavors of the same

117.6

document

118.719

so down here in the right hand corner is

121.119

a

122

clean man

124.399

uh

125.28

text written in ascii code

128.72

above it is a the same uh text in pdf

133.04

apache fop

135.12

uh to the top left is your standard pdf

138.72

file so if you actually try to read the

140.72

text of pdf this is what you would see

143.52

and then in the lower left is

146

how this text would look in html

148.64

so in order to translate this clean text

152.4

into html you have to have all these

154.56

different tags pdf you have to have all

157.2

the different pdf syntax

159.519

uh pdf fob it see it's a little cleaner

162.56

to read but

164

you still have a lot more syntax in here

166.08

than you would just in a plain text

167.84

document

169.519

so this is kind of the beauty

172.4

of using ascii doc

174.56

it lets you write a very clean readable

177.519

text document that you can read from

180.08

any essentially command line

182.319

text editor whatever

184.48

but you can convert this document to any

186.879

format that you need for the web

189.68

uh or even just for straight up

191.519

documentation

193.12

so if you want to create like a pdf book

195.599

or a manual that you could publish with

197.92

your software

199.76

you could take the ascii doc here and

202.239

then just

203.36

run it through the compiler and it would

205.12

generate the man file it would generate

207.76

the pdf file

209.68

or the ebook file that you could then

211.599

publish

213.92

all right so that's it for the slides

215.44

for now so let's actually get out here

217.28

this is going to be more of a hands-on

219.04

today

222.08

all right so out here let's start by

224.64

going to the ascii homepage

226.72

so

227.4

asciidocs.org

229.2

is the base homepage for ascii docs

232.799

it's got a fairly straightforward

234.72

installation section here

236.799

down at the bottom

239.04

it's installed from a github repository

242.48

uh which by the way i found out that

244.08

asking docs is

246.4

kind of also the de facto documentation

249.12

format that

250.56

github is using

254.879

so if you want to install

257.28

on windows your setups here it's pretty

259.68

straightforward

261.759

um

263.12

linux is also pretty straightforward

266.16

mac

267.04

has a

268.479

little uh issue right now so

271.84

homebrew has kind of been disabled from

274.479

the pseudo level

276.56

so if you want to install

279.28

ascii docs on a mac you have to actually

281.52

configure

283.28

the user rights to the folders for the

285.52

installation

289.36

the other thing it's going to want is

291.36

it's also going to require python 3

294.08

for your installation so that you can

296.16

actually run python

298.08

to convert the documentation

301.12

so for instance

302.8

uh we have

304.32

to test the installation so we have a

306.16

doc asciidoc.txt

310

i've got this installed already

314.16

here

316.72

development

318.479

deducts

320.56

citation

321.68

so here we have an ascii.txt

326

and as you can see it's just a straight

328.88

text document

330.8

but using the ascii

333.52

doc format

335.199

and we'll walk through what each of

336.639

these syntaxes mean here

338.96

but just if i scroll through this you

341.759

can see that this is a very readable

344

document it's very clean

347.039

uh i mean and you can you can understand

349.919

it

351.36

now

352.639

if i close this document here

356.4

and i run the converter

358.639

so if i ran this python ascii docs pi

362.639

against the text file

366.319

i've already done

367.919

so here we would see

370.479

the html version of that same text file

374.08

so now we have all of our links

378

and we have all the documentation

382.639

this is the power of ascii docs so ascii

385.36

docs can look very clean

387.919

from a ascii perspective from a command

390.56

line perspective or text document

393.039

but then you can convert it to any

394.56

format that you need

396.319

and then once you convert it you can

397.919

then deploy it with your application

400.479

either be an e-reader file

402.88

or you can deploy the html straight to

405.039

your website

409.599

all right so i'm going to jump out to

411.36

this other url here

413.52

uh

414.72

spartan.github.io

417.72

asky.box

419.599

now you can install this yourself

422.4

but

423.199

there's a couple different ones of these

424.8

online

426.08

so you don't really need to do

428.4

the setup yourself this is just kind of

430.16

a text editor that you can type and

433.84

type your ascii code here and you'll see

436.16

the

437.039

output over here

439.44

so the first thing

440.8

i want to show you is so if we look at

444.4

the

448.56

ascii.txt

455.28

we have this header information here

459.599

drop this in here so this

462

website

463.28

currently ignores this they're running a

465.28

different theme

466.8

but you can put in a header information

468.72

this way

470.16

and it will have like author information

474.4

email

476

different types of format text

477.919

documentation icons numbering and

480.4

website

482

uh i believe this guy is running a ruby

484.319

implementation so the other way to

486.319

display your header

488.319

is

489.759

with

491.199

the underlines

493.919

or we can do

495.44

there we are dashes

498.16

we have one two three four five six

500.319

seven eight nine ten eleven twelve

502.96

so twelve dashes

505.12

gets you a title of your document

508.4

and the little block underneath it so

510.879

that everything you type is now going to

512.479

be inside of our block

516.959

we could put some text in there

521.44

with some markup

524.72

so here on the left

527.279

there is no reason to prefer

530.24

this particular markup

532.64

it has all the features footers and so

535.44

on

536.16

and on the right it

538.08

is kind of cut off right now

540.56

this is using the uh pac-man

544.88

uh i believe this has like uh ruby and

547.279

pac-man for this particular editor

553.68

there's some things we can do so

556.88

if you're thinking like html

560

we'll leave our

562.64

title here

567.44

and let's put in a

569.6

header

572.32

so headers in html

574.959

are the typical h1 through h5

580.48

well in

581.76

ascii docs

583.44

you can represent the levels or your

586.24

headers

587.519

like

588.839

so we have

591.44

the dashes

592.959

two three four five six seven so seven

595.839

dashes

597.12

is equivalent of

598.959

h1

603.44

as you can see you start with your

605.68

header

606.64

you follow it with the dashes

609.2

and it's translated to a header

611.839

anything after the dash is it's just

613.76

plain text

630.72

actually what you have to do is you have

632.079

to make sure that you have

634

the dash under each

636.48

character that represents your title or

638.88

your

640

headers

642.079

so here we have example one

648.48

then you have your different levels so

650.32

this is h2

652

this is represented by squiggles

658.839

if shift backwards hyphen

662.48

and you have your carrots and then

664.32

pluses for level four

673.04

we have our examples

674.88

so

678.399

one

681.04

dashes

684.48

two

686.079

wiggles

694.8

three

696.64

are carrots

710.48

h4

712.399

or plus

725.2

and we can also represent these

728.48

the same way with equals

731.68

so if i do equal equal

733.92

i can then do level one

736.32

which is our h1

739.76

if i do three

742.56

now in h2

744.639

this is kind of a cleaner way of doing

747.76

your headers or your

750

different levels

752.399

level three

763.68

as you can see over here it's fairly

765.44

readable it translates really well

770.639

right so if we just want text you can

772.32

just start typing text

776.24

creates any text underneath like a

778.88

a p tag in html so it's like p

782.72

so there's no enters you have to put

784.48

actual breaks

786.72

if you want a title

790.639

inside of your documentation

792.639

you start with a period

795.2

and then you just do

797.279

title

801.6

then once you put some text underneath

803.2

it you see that the title pops up

815.6

paragraph

818.079

next

823.279

now if i want to

825.519

do a literal paragraph

828.8

you have to start with a space

834.16

and you'll see it puts a

836.24

block around it

838.32

and then what you do here is everything

840.24

you type

843.76

it reads the enter key

847.36

so this is now traded like a

850.32

three

852.32

let's pre-format it

856.48

then now you can do all your indentation

861.199

anytime you put a space in between

864

it will put a block

867.519

for those horizontal lines

872.24

some other things that are cool with

873.76

using ascii

875.92

you can

877.279

do tip

882.639

now it becomes a tip block

888.639

if you apply formatting you can change

890.639

icons so this could be like an

892.639

information icon a warning icon

896.72

you can also do things like important

899.519

caution

901.04

warnings

910.839

yep text

922

a warning block

924.639

and a caution block now this guy

927.279

doesn't have the icons installed

929.68

but like i said this could be

932.16

uh just like a little notepad

934.32

or

935.519

an information icon

937.519

uh this could be like an alert

939.04

exclamation point

940.959

uh this could be like a red warning stop

943.36

sign

944.48

uh caution

946.959

the other thing you can do with these is

948.8

you can also

951.519

essentially they're

952.839

a a block so every time you keep typing

958

it just keeps adding it

964.72

it keeps expanding

967.6

you can format that

971.839

another way you could also do a note

974.639

so if we want to change this up here

978.56

with our title

980

but then also make this a note

983.519

do this

988.639

all caps

993.92

and now it creates a note block

997.279

and you can also change your note to be

999.12

an icon

1000.399

as well

1002.32

you could also do things like

1004.72

code

1012.72

if you give it a title

1014.48

you put in the source so this is like

1016.399

the code tag in html

1018.8

and then you can actually put in your

1020.24

code

1022.32

if you installed the theme or the plugin

1025.919

for the code

1027.36

the code will actually be color coded as

1030.16

if it was in an editor

1033.27

[Music]

1047.839

you